summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/Server/Lint
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2013-09-09 17:01:16 -0400
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2013-09-09 17:01:16 -0400
commite46f830d3bef0c4b3917337e41f7a673e5590339 (patch)
tree08cb573f63b01ab4249dd3fb0ed389231630fb1b /src/lib/Bcfg2/Server/Lint
parent6c132ceee323c7935c9035ab9c3d91d40bfe9a4d (diff)
parente95a48a1c28b634adbb8f1aae0f3b586146086f0 (diff)
downloadbcfg2-e46f830d3bef0c4b3917337e41f7a673e5590339.tar.gz
bcfg2-e46f830d3bef0c4b3917337e41f7a673e5590339.tar.bz2
bcfg2-e46f830d3bef0c4b3917337e41f7a673e5590339.zip
Merge branch 'maint'
Conflicts: src/lib/Bcfg2/Server/Plugins/Cfg/__init__.py
Diffstat (limited to 'src/lib/Bcfg2/Server/Lint')
-rw-r--r--src/lib/Bcfg2/Server/Lint/Cfg.py20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/lib/Bcfg2/Server/Lint/Cfg.py b/src/lib/Bcfg2/Server/Lint/Cfg.py
index 79fb06695..7716cd5c7 100644
--- a/src/lib/Bcfg2/Server/Lint/Cfg.py
+++ b/src/lib/Bcfg2/Server/Lint/Cfg.py
@@ -1,11 +1,11 @@
""" ``bcfg2-lint`` plugin for :ref:`Cfg
<server-plugins-generators-cfg>` """
-
import os
import Bcfg2.Options
from fnmatch import fnmatch
from Bcfg2.Server.Lint import ServerPlugin
+from Bcfg2.Server.Plugins.Cfg import CfgGenerator
class Cfg(ServerPlugin):
@@ -15,12 +15,28 @@ class Cfg(ServerPlugin):
for basename, entry in list(self.core.plugins['Cfg'].entries.items()):
self.check_pubkey(basename, entry)
self.check_missing_files()
+ self.check_conflicting_handlers()
@classmethod
def Errors(cls):
return {"no-pubkey-xml": "warning",
"unknown-cfg-files": "error",
- "extra-cfg-files": "error"}
+ "extra-cfg-files": "error",
+ "multiple-global-handlers": "error"}
+
+ def check_conflicting_handlers(self):
+ """ Check that a single entryset doesn't have multiple
+ non-specific (i.e., 'all') handlers. """
+ cfg = self.core.plugins['Cfg']
+ for eset in cfg.entries.values():
+ alls = [e for e in eset.entries.values()
+ if (e.specific.all and
+ issubclass(e.__class__, CfgGenerator))]
+ if len(alls) > 1:
+ self.LintError("multiple-global-handlers",
+ "%s has multiple global handlers: %s" %
+ (eset.path, ", ".join(os.path.basename(e.name)
+ for e in alls)))
def check_pubkey(self, basename, entry):
""" check that privkey.xml files have corresponding pubkey.xml