From 05afbeaf3378d8af4c0342727e80ada9afe4f905 Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Fri, 20 May 2011 09:58:13 -0400 Subject: don't run lint server plugins if serverless plugins produced errors; avoids an ugly stack trace if a file fails to validate --- src/sbin/bcfg2-lint | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/sbin/bcfg2-lint') diff --git a/src/sbin/bcfg2-lint b/src/sbin/bcfg2-lint index 3c9bc44b3..464e839e5 100755 --- a/src/sbin/bcfg2-lint +++ b/src/sbin/bcfg2-lint @@ -184,8 +184,20 @@ if __name__ == '__main__': config=config, setup=setup) if serverplugins: - run_server_plugins(serverplugins, errorhandler=errorhandler, - config=config, setup=setup) + if errorhandler.errors: + # it would be swell if we could try to start the server + # even if there were errors with the serverless plugins, + # but since XML parsing errors occur in the FAM thread + # (not in the core server thread), there's no way we can + # start the server and try to catch exceptions -- + # bcfg2-lint isn't in the same stack as the exceptions. + # so we're forced to assume that a serverless plugin error + # will prevent the server from starting + print("Serverless plugins encountered errors, skipping server " + "plugins") + else: + run_server_plugins(serverplugins, errorhandler=errorhandler, + config=config, setup=setup) if errorhandler.errors or errorhandler.warnings or setup['verbose']: print("%d errors" % errorhandler.errors) -- cgit v1.2.3-1-g7c22