aboutsummaryrefslogtreecommitdiff
path: root/tests/test-opts-visitor.c
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2016-02-23 10:51:46 +0000
committerMarkus Armbruster <armbru@redhat.com>2016-03-04 17:16:32 +0100
commite55250c6cb4cf836f9188095a21c85f663aac06b (patch)
tree6d740ef0dc64884612e4b7519d4a01beb41adc1c /tests/test-opts-visitor.c
parent3c0f12df65da872d5fbccae469f2cb21ed1c03b7 (diff)
qmp-shell: fix pretty printing of JSON responses
Pretty printing of JSON responses is important to be able to understand large responses from query commands in particular. Unfortunately this was broken during the addition of the verbose flag in commit 1ceca07e48ead0dd2e41576c81d40e6a91cafefd Author: John Snow <jsnow@redhat.com> Date: Wed Apr 29 15:14:04 2015 -0400 scripts: qmp-shell: Add verbose flag This is because that change turned the python data structure into a formatted JSON string before the pretty print was given it. So we're just pretty printing a string, which is a no-op. The original pretty printer would output python objects. (QEMU) query-chardev { u'return': [ { u'filename': u'vc', u'frontend-open': False, u'label': u'parallel0'}, { u'filename': u'vc', u'frontend-open': True, u'label': u'serial0'}, { u'filename': u'unix:/tmp/qemp,server', u'frontend-open': True, u'label': u'compat_monitor0'}]} This fixes the problem by switching to outputting pretty formatted JSON text instead. This has the added benefit that the pretty printed output is now valid JSON text. Due to the way the verbose flag was handled, the pretty printing now applies to the command sent, as well as its response: (QEMU) query-chardev { "execute": "query-chardev", "arguments": {} } { "return": [ { "frontend-open": false, "label": "parallel0", "filename": "vc" }, { "frontend-open": true, "label": "serial0", "filename": "vc" }, { "frontend-open": true, "label": "compat_monitor0", "filename": "unix:/tmp/qmp,server" } ] } Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-Id: <1456224706-1591-1-git-send-email-berrange@redhat.com> Tested-by: Kashyap Chamarthy <kchamart@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com> [Bonus fix: multiple -p now work] Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'tests/test-opts-visitor.c')
0 files changed, 0 insertions, 0 deletions