mirror of
https://github.com/ansible/awx.git
synced 2026-05-11 19:37:38 -02:30
Merge pull request #4648 from ryanpetrello/format-metrics-human
cli: add special code for formatting metrics and settings with -f human Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
@@ -168,10 +168,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()
|
||||
|
||||
Reference in New Issue
Block a user