Many JSON commands (osd dump, et. al.) used to print a status
line first before the actual output; this has been fixed, but there
are scripts/tools/etc. that expect it. A simple compatibility hack
is to output a blank line, which won't confuse properly-written
JSON parsers, but will allow the tools-with-workarounds to continue
to work.
Signed-off-by: Dan Mick <dan.mick@inktank.com>
outf.write(outbuf)
outf.close()
else:
+ # hack: old code printed status line before many json outputs
+ # (osd dump, etc.) that consumers know to ignore. Add blank line
+ # to satisfy consumers that skip the first line, but not annoy
+ # consumers that don't.
+ if parsed_args.output_format and \
+ parsed_args.output_format.startswith('json'):
+ sys.stdout.write('\n');
+
sys.stdout.write(outbuf)
# this assumes outs never has useful command output, only status