cli: make launch with --monitor return code respect the final job status

see: https://github.com/ansible/awx/issues/5920
see: https://github.com/ansible/awx/issues/6079
This commit is contained in:
Ryan Petrello 2020-02-26 08:45:08 -05:00
parent 22d4e60028
commit 946d643795
No known key found for this signature in database
GPG Key ID: F2AA5F2122351777
2 changed files with 4 additions and 0 deletions

View File

@ -200,6 +200,8 @@ class CLI(object):
)
if formatted:
print(utils.to_str(formatted), file=self.stdout)
if hasattr(response, 'rc'):
raise SystemExit(response.rc)
else:
if six.PY3:
self.parser.print_help()

View File

@ -90,6 +90,8 @@ class Launchable(object):
)
if status:
response.json['status'] = status
if status in ('failed', 'error'):
setattr(response, 'rc', 1)
return response
def perform(self, **kwargs):