]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind: support mon target, and clean up tool
authorliuchang0812 <liuchang0812@gmail.com>
Wed, 31 May 2017 13:03:38 +0000 (21:03 +0800)
committerliuchang0812 <liuchang0812@gmail.com>
Mon, 5 Jun 2017 05:44:31 +0000 (13:44 +0800)
Signed-off-by: liuchang0812 <liuchang0812@gmail.com>
src/ceph.in
src/pybind/ceph_argparse.py

index e0c715fb68155489bc705535263da536b46d6c9f..2eed8e4e4e0067de63911582426e5f3dac199c6e 100755 (executable)
@@ -920,10 +920,6 @@ def main():
     if len(childargs) >= 3 and childargs[0] == 'tell' and childargs[2] == 'help':
         target = childargs[1].split('.')
         if validate_target(target):
-            if len(target) == 1: 
-                # TODO(Chang Liu): for "mon" target only, we should remove this
-                # patch after pybind supports this target format.
-                target.append("")
             return do_extended_help(parser, childargs, target, None)
         else:
             print('target {0} doesn\'t exists, please pass correct target to tell command, such as mon.a/'
index f188d8f236ac3ebf648c2d7ad2f20e6d3c3acb01..54fbdeb49f2e2971a5777a4627efc8ee2ae41c1b 100644 (file)
@@ -395,6 +395,10 @@ class CephName(CephArgtype):
             self.nametype = "mgr"
             self.val = s
             return
+        elif s == "mon":
+            self.nametype = "mon"
+            self.val = s
+            return
         if s.find('.') == -1:
             raise ArgumentFormat('CephName: no . in {0}'.format(s))
         else:
@@ -1262,7 +1266,7 @@ def send_command(cluster, target=('mon', ''), cmd=None, inbuf=b'', timeout=0,
             if verbose:
                 print('{0} to {1}'.format(cmd, target[0]),
                       file=sys.stderr)
-            if target[1] == '':
+            if len(target) < 2 or target[1] == '':
                 ret, outbuf, outs = run_in_thread(
                     cluster.mon_command, cmd, inbuf, timeout)
             else: