diff options
author | Narayan Desai <desai@mcs.anl.gov> | 2008-04-08 17:10:27 +0000 |
---|---|---|
committer | Narayan Desai <desai@mcs.anl.gov> | 2008-04-08 17:10:27 +0000 |
commit | b44aeec328eacb72e54ab4dcc18bf4490ece8108 (patch) | |
tree | 1f2e27a435d892053a21d8fb97c520b385faa98f /src/lib | |
parent | 4375f9d65ffb52c455e9601d2de88b17d7f3eb26 (diff) | |
download | bcfg2-b44aeec328eacb72e54ab4dcc18bf4490ece8108.tar.gz bcfg2-b44aeec328eacb72e54ab4dcc18bf4490ece8108.tar.bz2 bcfg2-b44aeec328eacb72e54ab4dcc18bf4490ece8108.zip |
Move base data caching es class to Plugin.py
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@4488 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/Server/Plugin.py | 13 | ||||
-rw-r--r-- | src/lib/Server/Plugins/Cfg.py | 15 |
2 files changed, 14 insertions, 14 deletions
diff --git a/src/lib/Server/Plugin.py b/src/lib/Server/Plugin.py index 4a973ba1c..916927bfa 100644 --- a/src/lib/Server/Plugin.py +++ b/src/lib/Server/Plugin.py @@ -432,6 +432,19 @@ class Specificity: return True return False +class SpecificData(object): + def __init__(self, name, _, specific): + self.name = name + self.specific = specific + + def handle_event(self, event): + if event.code2str() == 'deleted': + return + try: + self.data = open(self.name).read() + except: + logger.error("Failed to read file %s" % self.name) + class EntrySet: '''Entry sets deal with the host- and group-specific entries''' ignore = re.compile("^(.*~|\\..*\\.(tmp|sw[px]))$") diff --git a/src/lib/Server/Plugins/Cfg.py b/src/lib/Server/Plugins/Cfg.py index 291ee2c9f..9e078e94f 100644 --- a/src/lib/Server/Plugins/Cfg.py +++ b/src/lib/Server/Plugins/Cfg.py @@ -34,19 +34,6 @@ def process_delta(data, delta): raise Bcfg2.Server.Plugin.PluginExecutionError, ('delta', delta) return output -class CfgEntry(object): - def __init__(self, name, _, specific): - self.name = name - self.specific = specific - - def handle_event(self, event): - if event.code2str() == 'deleted': - return - try: - self.data = open(self.name).read() - except: - logger.error("Failed to read file %s" % self.name) - class CfgMatcher: def __init__(self, fname): name = re.escape(fname) @@ -138,7 +125,7 @@ class Cfg(Bcfg2.Server.Plugin.GroupSpool): __author__ = 'bcfg-dev@mcs.anl.gov' use_props = False es_cls = CfgEntrySet - es_child_cls = CfgEntry + es_child_cls = Bcfg2.Server.Plugin.SpecificData def AcceptChoices(self, entry, metadata): return self.entries[entry.get('name')].list_accept_choices(metadata) |