summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Weiß <holger@zedat.fu-berlin.de>2011-10-20 13:05:30 +0200
committerHolger Weiß <holger@zedat.fu-berlin.de>2011-10-20 13:05:30 +0200
commit8f78b4c7947e84062fc01e79939b159014dbe6d4 (patch)
tree7d1c18c72805328c7d6a3af2e86c8bd1709008c2
parent6c681bd7340c8526631766afe92e4f9f02117834 (diff)
downloadbcfg2-8f78b4c7947e84062fc01e79939b159014dbe6d4.tar.gz
bcfg2-8f78b4c7947e84062fc01e79939b159014dbe6d4.tar.bz2
bcfg2-8f78b4c7947e84062fc01e79939b159014dbe6d4.zip
Don't cache StructFile entries
Re-parse the contents of a StructFile each time they are requested, instead of caching them. This makes sure that any group membership changes are taken into account when <Group> tags are parsed.
-rw-r--r--src/lib/Server/Plugin.py12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/lib/Server/Plugin.py b/src/lib/Server/Plugin.py
index 1a6399d48..c09a37ed8 100644
--- a/src/lib/Server/Plugin.py
+++ b/src/lib/Server/Plugin.py
@@ -612,7 +612,6 @@ class StructFile(XMLFileBacked):
def __init__(self, name):
XMLFileBacked.__init__(self, name)
- self.matches = {}
def _match(self, item, metadata):
""" recursive helper for Match() """
@@ -646,13 +645,10 @@ class StructFile(XMLFileBacked):
def Match(self, metadata):
"""Return matching fragments of independent."""
- if metadata.hostname not in self.matches:
- rv = []
- for child in self.entries:
- rv.extend(self._match(child, metadata))
- logger.debug("File %s got %d match(es)" % (self.name, len(rv)))
- self.matches[metadata.hostname] = rv
- return self.matches[metadata.hostname]
+ rv = []
+ for child in self.entries:
+ rv.extend(self._match(child, metadata))
+ return rv
class INode: