Commit f1488332 authored by Petr Pudlak's avatar Petr Pudlak
Browse files

Support for a read-only detached copy of the configuration

The detached configuration doesn't do any kind of locking or
communication with WConfd, it just holds a static snapshot of the
Signed-off-by: default avatarPetr Pudlak <>
Reviewed-by: default avatarKlaus Aehlig <>
parent 95b9e1dd
......@@ -3087,6 +3087,14 @@ class ConfigWriter(object):
return self._ConfigData().HasAnyDiskOfType(dev_type)
def GetDetachedConfig(self):
"""Returns a detached version of a ConfigManager, which represents
a read-only snapshot of the configuration at this particular time.
return DetachedConfig(self._ConfigData())
def Update(self, target, feedback_fn, ec_id=None):
"""Notify function to be called after updates.
......@@ -3424,3 +3432,22 @@ class ConfigWriter(object):
if not self._offline:
class DetachedConfig(ConfigWriter):
def __init__(self, config_data):
super(DetachedConfig, self).__init__(self, offline=True)
def _WriteCallError():
raise errors.ProgrammerError("DetachedConfig supports only read-only"
" operations")
def _OpenConfig(self, shared):
if not shared:
def _CloseConfig(self, save):
if save:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment