From: Sage Weil Date: Sun, 16 Jun 2013 20:36:19 +0000 (-0700) Subject: ceph: do not print status to output file when talking to old mons X-Git-Tag: v0.65~57 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=efebdba0119f3ac361448924258e263e8c9dbdff;p=ceph.git 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 --- 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)