summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2013-03-26 10:25:46 -0400
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2013-03-26 10:25:46 -0400
commitd92f67d2f8148afd191c292903e3fb6db9abddbc (patch)
treebc6ae6563845e9c6dbd7916b307d7e6c48a68037 /src
parent71769cd76d2fede1d858e8d35c5d5c62da8bde35 (diff)
downloadbcfg2-d92f67d2f8148afd191c292903e3fb6db9abddbc.tar.gz
bcfg2-d92f67d2f8148afd191c292903e3fb6db9abddbc.tar.bz2
bcfg2-d92f67d2f8148afd191c292903e3fb6db9abddbc.zip
bcfg2-lint: added check to ensure that default group is a profile group
Diffstat (limited to 'src')
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Metadata.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/lib/Bcfg2/Server/Plugins/Metadata.py b/src/lib/Bcfg2/Server/Plugins/Metadata.py
index fc5924bc4..b2c68c1a7 100644
--- a/src/lib/Bcfg2/Server/Plugins/Metadata.py
+++ b/src/lib/Bcfg2/Server/Plugins/Metadata.py
@@ -1482,6 +1482,7 @@ class MetadataLint(Bcfg2.Server.Lint.ServerPlugin):
self.duplicate_groups()
self.duplicate_default_groups()
self.duplicate_clients()
+ self.default_is_profile()
@classmethod
def Errors(cls):
@@ -1491,7 +1492,8 @@ class MetadataLint(Bcfg2.Server.Lint.ServerPlugin):
"non-profile-set-as-profile": "error",
"duplicate-group": "error",
"duplicate-client": "error",
- "multiple-default-groups": "error"}
+ "multiple-default-groups": "error",
+ "default-is-not-profile": "error"}
def deprecated_options(self):
""" check for the location='floating' option, which has been
@@ -1581,3 +1583,13 @@ class MetadataLint(Bcfg2.Server.Lint.ServerPlugin):
self.LintError("duplicate-%s" % etype,
"%s %s is defined multiple times:\n%s" %
(etype.title(), ename, "\n".join(els)))
+
+ def default_is_profile(self):
+ if (self.metadata.default and
+ not self.metadata.groups[self.metadata.default].is_profile):
+ xdata = \
+ self.metadata.groups_xml.xdata.xpath("//Group[@name='%s']" %
+ self.metadata.default)[0]
+ self.LintError("default-is-not-profile",
+ "Default group is not a profile group:\n%s" %
+ self.RenderXML(xdata))