mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 22:33:25 +00:00
Different return codes for different errors.
This commit is contained in:
@@ -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):
|
|||||||
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
|
||||||
|
|||||||
Reference in New Issue
Block a user