diff --git a/awxkit/awxkit/cli/client.py b/awxkit/awxkit/cli/client.py index 6ccef0f12f..6a7c4c3f51 100755 --- a/awxkit/awxkit/cli/client.py +++ b/awxkit/awxkit/cli/client.py @@ -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() diff --git a/awxkit/awxkit/cli/custom.py b/awxkit/awxkit/cli/custom.py index 81a189169a..0f876579bc 100644 --- a/awxkit/awxkit/cli/custom.py +++ b/awxkit/awxkit/cli/custom.py @@ -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):