summaryrefslogtreecommitdiffstats
path: root/src/lib/Server/Plugins
diff options
context:
space:
mode:
authorSol Jerome <sol.jerome@gmail.com>2011-08-21 18:45:10 -0500
committerSol Jerome <sol.jerome@gmail.com>2011-08-21 18:46:21 -0500
commit5360af9fe752850b164717f516afc6254bb6779a (patch)
treee461e8e65ea509e2d3e05c58461f41d7989c9ecd /src/lib/Server/Plugins
parent0d53d3c686883883e1c06db6f9051b1be60adfc2 (diff)
downloadbcfg2-5360af9fe752850b164717f516afc6254bb6779a.tar.gz
bcfg2-5360af9fe752850b164717f516afc6254bb6779a.tar.bz2
bcfg2-5360af9fe752850b164717f516afc6254bb6779a.zip
Cfg: Log error when base file missing (reported by Ana Guerrero)
Signed-off-by: Sol Jerome <sol.jerome@gmail.com>
Diffstat (limited to 'src/lib/Server/Plugins')
-rw-r--r--src/lib/Server/Plugins/Cfg.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/lib/Server/Plugins/Cfg.py b/src/lib/Server/Plugins/Cfg.py
index 8a212c819..a5c19e8fd 100644
--- a/src/lib/Server/Plugins/Cfg.py
+++ b/src/lib/Server/Plugins/Cfg.py
@@ -103,16 +103,19 @@ class CfgEntrySet(Bcfg2.Server.Plugin.EntrySet):
def sort_by_specific(self, one, other):
return cmp(one.specific, other.specific)
- def get_pertinent_entries(self, metadata):
+ def get_pertinent_entries(self, entry, metadata):
"""return a list of all entries pertinent
to a client => [base, delta1, delta2]
"""
matching = [ent for ent in list(self.entries.values()) if \
ent.specific.matches(metadata)]
matching.sort(key=operator.attrgetter('specific'))
- non_delta = [matching.index(m) for m in matching
- if not m.specific.delta]
- if not non_delta:
+ # base entries which apply to a client
+ # (e.g. foo, foo.G##_groupname, foo.H_hostname)
+ base_files = [matching.index(m) for m in matching
+ if not m.specific.delta]
+ if not base_files:
+ logger.error("No base file found for %s" % entry.get('name'))
raise Bcfg2.Server.Plugin.PluginExecutionError
base = min(non_delta)
used = matching[:base + 1]
@@ -121,7 +124,7 @@ class CfgEntrySet(Bcfg2.Server.Plugin.EntrySet):
def bind_entry(self, entry, metadata):
self.bind_info_to_entry(entry, metadata)
- used = self.get_pertinent_entries(metadata)
+ used = self.get_pertinent_entries(entry, metadata)
basefile = used.pop(0)
if entry.get('perms').lower() == 'inherit':
# use on-disk permissions