From f71e64bee3cd8b36824a0760999bb621c27f7235 Mon Sep 17 00:00:00 2001 From: liuchang0812 Date: Wed, 31 May 2017 21:03:38 +0800 Subject: [PATCH] pybind: support mon target, and clean up tool Signed-off-by: liuchang0812 --- src/ceph.in | 4 ---- src/pybind/ceph_argparse.py | 6 +++++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ceph.in b/src/ceph.in index e0c715fb68155..2eed8e4e4e006 100755 --- a/src/ceph.in +++ b/src/ceph.in @@ -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/' diff --git a/src/pybind/ceph_argparse.py b/src/pybind/ceph_argparse.py index f188d8f236ac3..54fbdeb49f2e2 100644 --- a/src/pybind/ceph_argparse.py +++ b/src/pybind/ceph_argparse.py @@ -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: -- 2.39.5