From 1d2edc1d811a831f7448a3ad10161b16dc9650cc Mon Sep 17 00:00:00 2001 From: Ryan Petrello Date: Mon, 26 Aug 2019 12:39:39 -0400 Subject: [PATCH] cli: fix a bug when printing complex data structures w/ -f human see: https://github.com/ansible/awx/issues/4567 --- awxkit/awxkit/cli/format.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/awxkit/awxkit/cli/format.py b/awxkit/awxkit/cli/format.py index 29dd54064d..be1a0e3722 100644 --- a/awxkit/awxkit/cli/format.py +++ b/awxkit/awxkit/cli/format.py @@ -140,7 +140,7 @@ def format_human(output, fmt): lines = [] if fmt == '.': fmt = 'id,name' - column_names = fmt.split(',') + column_names = [col.strip() for col in fmt.split(',')] if 'count' in output: output = output['results'] else: @@ -163,6 +163,8 @@ def format_human(output, fmt): try: return locale.format("%.*f", (0, int(v)), True) except (ValueError, TypeError): + if not isinstance(v, six.text_type): + return str(v) return v # calculate the max width of each column