Commit 05464816 by Aleksej Romanov

Different return codes for different errors.

parent 01e922aa
...@@ -129,9 +129,9 @@ if __name__ == '__main__': ...@@ -129,9 +129,9 @@ if __name__ == '__main__':
(runner, results) = cli.run(options, args) (runner, results) = cli.run(options, args)
for result in results['contacted'].values(): for result in results['contacted'].values():
if 'failed' in result or result.get('rc', 0) != 0: if 'failed' in result or result.get('rc', 0) != 0:
sys.exit(1) sys.exit(2)
if results['dark']: if results['dark']:
sys.exit(1) sys.exit(2)
except errors.AnsibleError, e: except errors.AnsibleError, e:
# Generic handler for ansible specific errors # Generic handler for ansible specific errors
print "ERROR: %s" % str(e) print "ERROR: %s" % str(e)
......
...@@ -143,7 +143,7 @@ def main(args): ...@@ -143,7 +143,7 @@ def main(args):
for h in hosts: for h in hosts:
stats = pb.stats.summarize(h) stats = pb.stats.summarize(h)
if stats['failures'] != 0 or stats['unreachable'] != 0: if stats['failures'] != 0 or stats['unreachable'] != 0:
sys.exit(1) return 2
except errors.AnsibleError, e: except errors.AnsibleError, e:
print >>sys.stderr, "ERROR: %s" % e print >>sys.stderr, "ERROR: %s" % e
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment