summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander.sulfrian@fu-berlin.de>2015-07-24 01:37:47 +0200
committerAlexander Sulfrian <alexander.sulfrian@fu-berlin.de>2015-07-27 14:43:26 +0200
commitd657ae4a8c2e1e60ff98c95f7939c3ec22ffe5d1 (patch)
tree49d363bb61ba71a547eeb18d61914ae182f8f38b
parentf2acd697d69351be036ffb089b8244accfe8ae06 (diff)
downloadbcfg2-d657ae4a8c2e1e60ff98c95f7939c3ec22ffe5d1.tar.gz
bcfg2-d657ae4a8c2e1e60ff98c95f7939c3ec22ffe5d1.tar.bz2
bcfg2-d657ae4a8c2e1e60ff98c95f7939c3ec22ffe5d1.zip
GroupLogic: Expire metadata cache on config file changes
-rw-r--r--src/lib/Bcfg2/Server/Plugins/GroupLogic.py13
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):