Merge pull request #12404 from ansible/revert-12335-feature/awx-cli-import-export-error-codes

Revert "import/export error codes when something bad happens"
This commit is contained in:
Sarabraj Singh
2022-06-21 22:01:46 -04:00
committed by GitHub
2 changed files with 3 additions and 26 deletions

View File

@@ -144,8 +144,6 @@ class Import(CustomCommand):
client.authenticate()
client.v2.import_assets(data)
self._has_error = getattr(client.v2, '_has_error', False)
return {}
@@ -176,11 +174,7 @@ class Export(CustomCommand):
kwargs = {resource: getattr(parsed, resource, None) for resource in EXPORTABLE_RESOURCES}
client.authenticate()
data = client.v2.export_assets(**kwargs)
self._has_error = getattr(client.v2, '_has_error', False)
return data
return client.v2.export_assets(**kwargs)
def parse_resource(client, skip_deprecated=False):
@@ -189,8 +183,6 @@ def parse_resource(client, skip_deprecated=False):
metavar='resource',
)
_system_exit = 0
# check if the user is running a custom command
for command in CustomCommand.__subclasses__():
client.subparsers[command.name] = subparsers.add_parser(command.name, help=command.help_text)
@@ -218,10 +210,6 @@ def parse_resource(client, skip_deprecated=False):
parser = client.subparsers[resource]
command = CustomCommand.registry[resource]()
response = command.handle(client, parser)
if getattr(command, '_has_error', False):
_system_exit = 1
if response:
_filter = client.get_config('filter')
if resource == 'config' and client.get_config('format') == 'human':
@@ -233,7 +221,7 @@ def parse_resource(client, skip_deprecated=False):
connection = None
formatted = format_response(Page.from_json(response, connection=connection), fmt=client.get_config('format'), filter=_filter)
print(formatted)
raise SystemExit(_system_exit)
raise SystemExit()
else:
return resource