add special code for formatting metrics and settings with -f human

see: https://github.com/ansible/awx/issues/4566
This commit is contained in:
Ryan Petrello
2019-09-03 16:56:13 -04:00
parent ba8b876dd3
commit 064f871fff
3 changed files with 49 additions and 7 deletions

View File

@@ -167,10 +167,23 @@ def parse_resource(client, skip_deprecated=False):
command = CustomCommand.registry[resource]()
response = command.handle(client, parser)
if response:
_filter = client.get_config('filter')
if (
resource == 'config' and
client.get_config('format') == 'human'
):
response = {
'count': len(response),
'results': [
{'key': k, 'value': v}
for k, v in response.items()
]
}
_filter = 'key, value'
formatted = format_response(
Page.from_json(response),
fmt=client.get_config('format'),
filter=client.get_config('filter'),
filter=_filter
)
print(formatted)
raise SystemExit()