Different return codes for different errors.

pull/1222/head
Aleksej Romanov 12 years ago
parent 01e922aa69
commit 05464816c2

@ -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)

@ -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

Loading…
Cancel
Save