diff options
Diffstat (limited to 'src/sbin/bcfg2-lint')
-rwxr-xr-x | src/sbin/bcfg2-lint | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/src/sbin/bcfg2-lint b/src/sbin/bcfg2-lint index ad6b6139c..5ee88535d 100755 --- a/src/sbin/bcfg2-lint +++ b/src/sbin/bcfg2-lint @@ -114,21 +114,6 @@ if __name__ == '__main__': config.read(setup['configfile']) config.read(setup['config']) - if setup['showerrors']: - if config.has_section("errors"): - econf = dict(config.items("errors")) - else: - econf = dict() - - print("%-35s %-35s" % ("Error name", "Handler (Default)")) - for err, default in Bcfg2.Server.Lint.ErrorHandler._errors.items(): - if err in econf and econf[err] != default: - handler = "%s (%s)" % (econf[err], default) - else: - handler = default - print("%-35s %-35s" % (err, handler)) - raise SystemExit(0) - # get list of plugins to run if setup['args']: allplugins = setup['args'] @@ -169,6 +154,15 @@ if __name__ == '__main__': errorhandler = get_errorhandler(config) + if setup['showerrors']: + for plugin in serverplugins.values() + serverlessplugins.values(): + errorhandler.RegisterErrors(getattr(plugin, 'Errors')()) + + print("%-35s %-35s" % ("Error name", "Handler")) + for err, handler in errorhandler._handlers.items(): + print("%-35s %-35s" % (err, handler.__name__)) + raise SystemExit(0) + run_serverless_plugins(serverlessplugins, errorhandler=errorhandler, config=config, setup=setup) |