Different return codes for different errors.

This commit is contained in:
Aleksej Romanov 2012-10-04 17:43:25 +07:00
parent 01e922aa69
commit 05464816c2
2 changed files with 3 additions and 3 deletions

View file

@ -129,9 +129,9 @@ if __name__ == '__main__':
(runner, results) = cli.run(options, args)
for result in results['contacted'].values():
if 'failed' in result or result.get('rc', 0) != 0:
sys.exit(1)
sys.exit(2)
if results['dark']:
sys.exit(1)
sys.exit(2)
except errors.AnsibleError, e:
# Generic handler for ansible specific errors
print "ERROR: %s" % str(e)

View file

@ -143,7 +143,7 @@ def main(args):
for h in hosts:
stats = pb.stats.summarize(h)
if stats['failures'] != 0 or stats['unreachable'] != 0:
sys.exit(1)
return 2
except errors.AnsibleError, e:
print >>sys.stderr, "ERROR: %s" % e