From 24f6403f1ba483b813e30ea15446a59090d90d90 Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Thu, 21 Apr 2011 14:43:39 -0400 Subject: 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 --- src/sbin/bcfg2-lint | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/sbin') 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]: -- cgit v1.2.3-1-g7c22