summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2012-08-16 08:43:05 -0400
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2012-08-16 08:43:05 -0400
commitd9f66bb49a6053ecfc50164bcef29f5a12c25085 (patch)
tree6b785c41c95f57b11b8d97e2eab8b8e0eacbf948 /src
parent6498e2e6e026bdff2eaac486810bdcfd850c2199 (diff)
downloadbcfg2-d9f66bb49a6053ecfc50164bcef29f5a12c25085.tar.gz
bcfg2-d9f66bb49a6053ecfc50164bcef29f5a12c25085.tar.bz2
bcfg2-d9f66bb49a6053ecfc50164bcef29f5a12c25085.zip
FileProbes: fixed bug introduced by Cfg rewrite
Diffstat (limited to 'src')
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Cfg/__init__.py13
-rw-r--r--src/lib/Bcfg2/Server/Plugins/FileProbes.py10
2 files changed, 16 insertions, 7 deletions
diff --git a/src/lib/Bcfg2/Server/Plugins/Cfg/__init__.py b/src/lib/Bcfg2/Server/Plugins/Cfg/__init__.py
index 5a7edbaff..e93fb9da7 100644
--- a/src/lib/Bcfg2/Server/Plugins/Cfg/__init__.py
+++ b/src/lib/Bcfg2/Server/Plugins/Cfg/__init__.py
@@ -407,6 +407,19 @@ class Cfg(Bcfg2.Server.Plugin.GroupSpool,
SETUP.add_option('validate', Bcfg2.Options.CFG_VALIDATION)
SETUP.reparse()
+ def has_generator(self, entry, metadata):
+ """ return True if the given entry can be generated for the
+ given metadata; False otherwise """
+ if entry.get('name') not in self.entries:
+ return False
+
+ for ent in self.entries[entry.get('name')].entries.values():
+ if ent.__specific__ and not ent.specific.matches(metadata):
+ continue
+ if isinstance(ent, CfgGenerator):
+ return True
+ return False
+
def AcceptChoices(self, entry, metadata):
return self.entries[entry.get('name')].list_accept_choices(entry,
metadata)
diff --git a/src/lib/Bcfg2/Server/Plugins/FileProbes.py b/src/lib/Bcfg2/Server/Plugins/FileProbes.py
index 3d6c190a5..550ca7d72 100644
--- a/src/lib/Bcfg2/Server/Plugins/FileProbes.py
+++ b/src/lib/Bcfg2/Server/Plugins/FileProbes.py
@@ -69,13 +69,9 @@ class FileProbes(Bcfg2.Server.Plugin.Plugin,
# do not probe for files that are already in Cfg and
# for which update is false; we can't possibly do
# anything with the data we get from such a probe
- try:
- if (entry.get('update', 'false').lower() == "false" and
- cfg.entries[path].get_pertinent_entries(entry,
- metadata)):
- continue
- except (KeyError, Bcfg2.Server.Plugin.PluginExecutionError):
- pass
+ if (entry.get('update', 'false').lower() == "false" and
+ not cfg.has_generator(entry, metadata)):
+ continue
self.entries[metadata.hostname][path] = entry
probe = lxml.etree.Element('probe', name=path,
source=self.name,