Revision 05f86716 lib/ssconf.py
b/lib/ssconf.py | ||
---|---|---|
47 | 47 |
Other particularities of the datastore: |
48 | 48 |
- keys are restricted to predefined values |
49 | 49 |
- values are small (<4k) |
50 |
- some keys are handled specially (read from the system, so |
|
51 |
we can't update them) |
|
50 |
- some keys are handled specially (read from the system) |
|
52 | 51 |
|
53 | 52 |
""" |
54 | 53 |
_SS_FILEPREFIX = "ssconf_" |
... | ... | |
170 | 169 |
raise errors.ConfigurationError("Failed to convert config version %s to" |
171 | 170 |
" int: '%s'" % (value, str(err))) |
172 | 171 |
|
172 |
def GetFileList(self): |
|
173 |
"""Return the list of all config files. |
|
174 |
|
|
175 |
This is used for computing node replication data. |
|
176 |
|
|
177 |
""" |
|
178 |
return [self.KeyToFilename(key) for key in self._VALID_KEYS] |
|
179 |
|
|
180 |
|
|
181 |
class WritableSimpleStore(SimpleStore): |
|
182 |
"""This is a read/write interface to SimpleStore, which is used rarely, when |
|
183 |
values need to be changed. Since WriteFile handles updates in an atomic way |
|
184 |
it should be fine to use two WritableSimpleStore at the same time, but in |
|
185 |
the future we might want to put additional protection for this class. |
|
186 |
|
|
187 |
A WritableSimpleStore cannot be used to update system-dependent values. |
|
188 |
|
|
189 |
""" |
|
190 |
|
|
173 | 191 |
def SetKey(self, key, value): |
174 | 192 |
"""Set the value of a key. |
175 | 193 |
|
... | ... | |
181 | 199 |
utils.WriteFile(file_name, data="%s\n" % str(value), |
182 | 200 |
uid=0, gid=0, mode=0400) |
183 | 201 |
|
184 |
def GetFileList(self): |
|
185 |
"""Return the list of all config files. |
|
186 |
|
|
187 |
This is used for computing node replication data. |
|
188 |
|
|
189 |
""" |
|
190 |
return [self.KeyToFilename(key) for key in self._VALID_KEYS] |
Also available in: Unified diff