summaryrefslogtreecommitdiffstats
path: root/src/sbin/bcfg2-lint
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2011-04-21 14:43:39 -0400
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2011-04-21 14:43:39 -0400
commit24f6403f1ba483b813e30ea15446a59090d90d90 (patch)
tree28ee707cca44ba49a8ce775842e5d890bae38b34 /src/sbin/bcfg2-lint
parent788d6e5cc035710999d2097c4ef2da69568e8995 (diff)
downloadbcfg2-24f6403f1ba483b813e30ea15446a59090d90d90.tar.gz
bcfg2-24f6403f1ba483b813e30ea15446a59090d90d90.tar.bz2
bcfg2-24f6403f1ba483b813e30ea15446a59090d90d90.zip
Misc. bcfg2-lint fixes and tweaks:
* fixed bcfg2-lint bug with older pythons * made bcfg2-lint silent by default on success * adjusted bcfg2-lint defaults and alerting levels to work better out-of-the-box
Diffstat (limited to 'src/sbin/bcfg2-lint')
-rwxr-xr-xsrc/sbin/bcfg2-lint15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/sbin/bcfg2-lint b/src/sbin/bcfg2-lint
index 91869617f..cfb37a206 100755
--- a/src/sbin/bcfg2-lint
+++ b/src/sbin/bcfg2-lint
@@ -57,9 +57,14 @@ def run_plugin(plugin, plugin_name, setup=None, args=None, config=None,
args.append(dict(config.items(plugin_name), **setup))
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
+ kwargs = dict(files=files)
+
try:
- return plugin(*args, files=files).Run()
+ return plugin(*args, **kwargs).Run()
except Exception, err:
logger.error("Failed to run plugin %s: %s" % (plugin, err))
raise SystemExit(1)
@@ -158,8 +163,10 @@ if __name__ == '__main__':
perrors = run_server_plugins(serverplugins, config=config, setup=setup)
errors = [errors[n] + perrors[n] for n in range(0, len(errors))]
- print "%d errors" % errors[0]
- print "%d warnings" % errors[1]
+ if errors[0] or errors[1] or setup['verbose']:
+ print "%d errors" % errors[0]
+ print "%d warnings" % errors[1]
+
if errors[0]:
raise SystemExit(2)
elif errors[1]: