]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph: old daemons output to outs and outbuf, combine
authorDan Mick <dan.mick@inktank.com>
Fri, 7 Jun 2013 23:39:34 +0000 (16:39 -0700)
committerDan Mick <dan.mick@inktank.com>
Sat, 8 Jun 2013 00:29:03 +0000 (17:29 -0700)
When talking to old daemons, if a command succeeds, there may be
output on outs, outbuf, or both; combine them if there's no error,
and clear outs so it's not treated as stderr fodder.

Signed-off-by: Dan Mick <dan.mick@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
src/ceph.in

index 74a76acfcb1813d8ec67e2aa38c8615b1e816ab3..ad2df9ad35d27cff19621c75b1456ce67828f93a 100755 (executable)
@@ -1426,7 +1426,8 @@ def main():
             # try old mon
             ret, outbuf, outs = send_command(cmd=['status'])
             # old mon returns status to outs...ick
-            outbuf = outs
+            if ret == 0:
+                outbuf += outs
         if ret:
             print >> sys.stderr, "status query failed: ", outs
             return ret
@@ -1487,6 +1488,11 @@ def main():
         if verbose:
             print '{0} to old {1}'.format(' '.join(childargs), target[0])
         ret, outbuf, outs = send_command(target, childargs, inbuf)
+        # combine nonerror outbuf and outs; either may have cmd output
+        if ret == 0:
+            outbuf += outs
+            # clear outs so generic code below doesn't print it to stderr
+            outs = ''
     elif ret:
         if ret < 0:
             ret = -ret