summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2011-05-18 10:44:50 -0400
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2011-05-18 10:44:50 -0400
commita7057ddac01f3e3a128448d806f4fb4e2e4876f6 (patch)
treeb8b2f62d66fab76005a4353fdd1a9de61a45cc1c
parent834c2fb89af7f9cb6c626090caac7fe6903e88e8 (diff)
downloadbcfg2-a7057ddac01f3e3a128448d806f4fb4e2e4876f6.tar.gz
bcfg2-a7057ddac01f3e3a128448d806f4fb4e2e4876f6.tar.bz2
bcfg2-a7057ddac01f3e3a128448d806f4fb4e2e4876f6.zip
fixed several major bugs in bcfg2-lint Validate plugin
-rw-r--r--src/lib/Server/Lint/Validate.py16
-rwxr-xr-xsrc/sbin/bcfg2-lint7
2 files changed, 15 insertions, 8 deletions
diff --git a/src/lib/Server/Lint/Validate.py b/src/lib/Server/Lint/Validate.py
index 834608378..c0a400dd6 100644
--- a/src/lib/Server/Lint/Validate.py
+++ b/src/lib/Server/Lint/Validate.py
@@ -14,7 +14,8 @@ class Validate(Bcfg2.Server.Lint.ServerlessPlugin):
self.filesets = {"metadata:groups":"%s/metadata.xsd",
"metadata:clients":"%s/clients.xsd",
"info":"%s/info.xsd",
- "%s/Bundler/*.{xml,genshi}":"%s/bundle.xsd",
+ "%s/Bundler/*.xml":"%s/bundle.xsd",
+ "%s/Bundler/*.genshi":"%s/bundle.xsd",
"%s/Pkgmgr/*.xml":"%s/pkglist.xsd",
"%s/Base/*.xml":"%s/base.xsd",
"%s/Rules/*.xml":"%s/rules.xsd",
@@ -33,14 +34,16 @@ class Validate(Bcfg2.Server.Lint.ServerlessPlugin):
@Bcfg2.Server.Lint.returnErrors
def Run(self):
- self.schemadir = self.config['schema']
+ schemadir = self.config['schema']
- for schemaname, path in self.filesets.items():
+ for path, schemaname in self.filesets.items():
try:
filelist = self.filelists[path]
except KeyError:
filelist = []
-
+
+ print "validating %s" % path
+ print "filelist = %s" % filelist
if filelist:
# avoid loading schemas for empty file lists
try:
@@ -48,8 +51,8 @@ class Validate(Bcfg2.Server.Lint.ServerlessPlugin):
schemadir))
except:
self.LintError("schema-failed-to-parse",
- "Failed to process schema %s",
- schemaname % schemadir)
+ "Failed to process schema %s" %
+ (schemaname % schemadir))
continue
for filename in filelist:
self.validate(filename, schemaname % schemadir,
@@ -132,6 +135,7 @@ class Validate(Bcfg2.Server.Lint.ServerlessPlugin):
for f in files
if f == 'info.xml'])
else:
+ print "globbing for %s" % (path % self.config['repo'])
self.filelists[path] = listfiles(path)
self.filelists['props'] = listfiles("%s/Properties/*.xml")
diff --git a/src/sbin/bcfg2-lint b/src/sbin/bcfg2-lint
index 6bc34433e..3c9bc44b3 100755
--- a/src/sbin/bcfg2-lint
+++ b/src/sbin/bcfg2-lint
@@ -50,10 +50,13 @@ def run_plugin(plugin, plugin_name, setup=None, errorhandler=None,
errorhandler = get_errorhandler(config)
if config is not None and config.has_section(plugin_name):
- args.append(dict(config.items(plugin_name), **setup))
+ arg = setup
+ for key, val in config.items(plugin_name):
+ arg[key] = val
+ args.append(arg)
else:
args.append(setup)
-
+
# older versions of python do not support mixing *-magic and
# non-*-magic (e.g., "plugin(*args, files=files)", so we do this
# all with *-magic