]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph.in: fix -h/help behavior for tell commands
authorSage Weil <sage@redhat.com>
Sat, 8 Feb 2020 14:49:50 +0000 (08:49 -0600)
committerSage Weil <sage@redhat.com>
Mon, 10 Feb 2020 14:24:44 +0000 (08:24 -0600)
- add "Tell $type commands" heading
- 'ceph tell mon.a -h' now works
- 'ceph tell mon.a prefix -h' also works

Signed-off-by: Sage Weil <sage@redhat.com>
qa/workunits/cephtool/test.sh
src/ceph.in

index 9a3a98b8dca16b9a190274febd1626ad1383fbb6..e97f9a13d43d8e91571fdb28fb2abe36b8dcaa2c 100755 (executable)
@@ -2673,7 +2673,9 @@ function test_mon_pool_application()
 
 function test_mon_tell_help_command()
 {
-  ceph tell mon.a help
+  ceph tell mon.a help | grep sync_force
+  ceph tell mon.a -h | grep sync_force
+  ceph tell mon.a config -h | grep 'config diff get'
 
   # wrong target
   expect_false ceph tell mon.zzz help
index d359e257cd6c45cd18d4859c9be55e0e183fe5c9..ced2c1effcf0e2bc3c2baac97366aff9d3314de8 100755 (executable)
@@ -1032,21 +1032,33 @@ def main():
         return 1
 
     if parsed_args.help:
-        hdr('Monitor commands:')
+        target = None
+        if len(childargs) >= 2 and childargs[0] == 'tell':
+            target = childargs[1].split('.')
+            if not validate_target(target):
+                print('target {0} doesn\'t exist; please pass correct target to tell command (e.g., mon.a, osd.1, mds.a, mgr)'.format(childargs[1]), file=sys.stderr)
+                return 1
+            childargs = childargs[2:]
+            hdr('Tell %s commands:' % target[0])
+        else:
+            hdr('Monitor commands:')
+            target = ('mon', '')
         if verbose:
             print('[Contacting monitor, timeout after %d seconds]' % timeout)
 
-        return do_extended_help(parser, childargs, ('mon', ''), ' '.join(childargs))
+        return do_extended_help(parser, childargs, target, ' '.join(childargs))
 
     # implement "tell service.id help"
     if len(childargs) >= 3 and childargs[0] == 'tell' and childargs[2] == 'help':
         target = childargs[1].split('.')
         if validate_target(target):
+            hdr('Tell %s commands' % target[0])
             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/'
                   'osd.1/mds.a/mgr'.format(childargs[1]), file=sys.stderr)
             return 1
+
     # implement -w/--watch_*
     # This is ugly, but Namespace() isn't quite rich enough.
     level = ''