diff options
author | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2015-10-05 13:19:59 -0500 |
---|---|---|
committer | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2015-10-05 13:19:59 -0500 |
commit | 470723f1c9eabbeec63bba154e6d5c6dc75153ac (patch) | |
tree | 63c1e4b6b6a3e7b589bb4380d4a1bd073d94b519 /src/lib/Bcfg2/Server/Plugins/GroupLogic.py | |
parent | 35a2ad1d76790b62b3dbb41cb7fa112c81dc4d5f (diff) | |
parent | 3d2fca1e8573d60e67bb2fe642fb78c517d5ccc2 (diff) | |
download | bcfg2-470723f1c9eabbeec63bba154e6d5c6dc75153ac.tar.gz bcfg2-470723f1c9eabbeec63bba154e6d5c6dc75153ac.tar.bz2 bcfg2-470723f1c9eabbeec63bba154e6d5c6dc75153ac.zip |
Merge pull request #299 from AlexanderS/fix/caching
Expire metadata cache in all Connector plugins.
Diffstat (limited to 'src/lib/Bcfg2/Server/Plugins/GroupLogic.py')
-rw-r--r-- | src/lib/Bcfg2/Server/Plugins/GroupLogic.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/lib/Bcfg2/Server/Plugins/GroupLogic.py b/src/lib/Bcfg2/Server/Plugins/GroupLogic.py index b60f60e65..184b362f9 100644 --- a/src/lib/Bcfg2/Server/Plugins/GroupLogic.py +++ b/src/lib/Bcfg2/Server/Plugins/GroupLogic.py @@ -13,6 +13,17 @@ class GroupLogicConfig(Bcfg2.Server.Plugin.StructFile): create = lxml.etree.Element("GroupLogic", nsmap=dict(py="http://genshi.edgewall.org/")) + def __init__(self, filename, core): + Bcfg2.Server.Plugin.StructFile.__init__(self, filename, + should_monitor=True) + self.core = core + + def Index(self): + Bcfg2.Server.Plugin.StructFile.Index(self) + + if self.core.metadata_cache_mode in ['cautious', 'aggressive']: + self.core.metadata_cache.expire() + def _match(self, item, metadata, *args): if item.tag == 'Group' and not len(item.getchildren()): return [item] @@ -39,7 +50,7 @@ class GroupLogic(Bcfg2.Server.Plugin.Plugin, Bcfg2.Server.Plugin.Plugin.__init__(self, core) Bcfg2.Server.Plugin.Connector.__init__(self) self.config = GroupLogicConfig(os.path.join(self.data, "groups.xml"), - should_monitor=True) + core=core) self._local = local() def get_additional_groups(self, metadata): |