diff options
author | Sage Weil <sage@inktank.com> | 2013-06-16 13:36:19 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-06-16 13:36:19 -0700 |
commit | efebdba0119f3ac361448924258e263e8c9dbdff (patch) | |
tree | b65052383c630b7a78c4408bc18d6b4a72a43480 | |
parent | 7e7ff7532d343c473178799e37f4b83cf29c4eee (diff) | |
download | ceph-efebdba0119f3ac361448924258e263e8c9dbdff.tar.gz |
ceph: do not print status to output file when talking to old mons
The old cli would send the status message to stdout instead of stderr;
we try to emulate that behavior when talking to old monitors because
they send some useful data to outs instead of the data payload.
However, when outputting to a *file*, the outs would still go to
stdout. Maintain that so that, e.g.,
ceph mon getmap -o /tmp/foo
doesn't prefix the monmap with 'got latest monmap\n'.
Signed-off-by: Sage Weil <sage@inktank.com>
-rwxr-xr-x | src/ceph.in | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/ceph.in b/src/ceph.in index 69608021f9b..c5ba2ce3d8a 100755 --- a/src/ceph.in +++ b/src/ceph.in @@ -1582,12 +1582,6 @@ def main(): if parsed_args.threshold: childargs.extend(['--threshold', parsed_args.threshold]) ret, outbuf, outs = send_command(target, childargs, inbuf) - # combine nonerror outbuf and outs; either may have cmd output - if ret == 0: - # old tool always added a newline - outbuf = outs + '\n' + outbuf - # clear outs so generic code below doesn't print it to stderr - outs = '' elif ret: if ret < 0: ret = -ret @@ -1613,7 +1607,11 @@ def main(): # this assumes outs never has useful command output, only status if outs: - print >> sys.stderr, prefix, outs + if compat and ret == 0: + # old cli/mon would send status string to stdout on non-error + print outs + else: + print >> sys.stderr, prefix, outs if (parsed_args.output_file): outf.write(outbuf) |