mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-03 23:14:02 -07:00
Indicate errors with exit code.
This commit is contained in:
parent
53d24ef002
commit
01e922aa69
2 changed files with 9 additions and 0 deletions
|
@ -127,6 +127,11 @@ if __name__ == '__main__':
|
|||
(options, args) = cli.parse()
|
||||
try:
|
||||
(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)
|
||||
if results['dark']:
|
||||
sys.exit(1)
|
||||
except errors.AnsibleError, e:
|
||||
# Generic handler for ansible specific errors
|
||||
print "ERROR: %s" % str(e)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue