summaryrefslogtreecommitdiffstats
path: root/src/ceph.in
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-10-22 20:23:28 +0200
committerSage Weil <sage@inktank.com>2013-10-22 21:34:41 +0200
commite9224755e2152eaf9c45b7420d9ae26b20f4e5c3 (patch)
tree505dfff46a6a2d27c70ca208586190c36c0cd8bd /src/ceph.in
parentceph: fixup do_help() function connection check (diff)
downloadceph-e9224755e2152eaf9c45b7420d9ae26b20f4e5c3.tar.xz
ceph-e9224755e2152eaf9c45b7420d9ae26b20f4e5c3.zip
ceph: print basic options before connecting
This will let you control-c if the mon is unresponsive. Signed-off-by: Sage Weil <sage@inktank.com>
Diffstat (limited to 'src/ceph.in')
-rwxr-xr-xsrc/ceph.in26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/ceph.in b/src/ceph.in
index 8d4562ec94e..1ce9715f8a7 100755
--- a/src/ceph.in
+++ b/src/ceph.in
@@ -166,12 +166,19 @@ def parse_cmdargs(args=None, target=''):
return parser, parsed_args, extras
-def do_help(parser, args):
+
+def hdr(s):
+ print '\n', s, '\n', '=' * len(s)
+
+def do_basic_help(parser, args):
"""
Print basic parser help
If the cluster is available, get and print monitor help
"""
+ hdr('General usage:')
+ parser.print_help()
+def do_extended_help(parser, args):
def help_for_sigs(sigs, partial=None):
sys.stdout.write(format_help(parse_json_funcsigs(sigs, 'cli'),
partial=partial))
@@ -187,18 +194,9 @@ def do_help(parser, args):
else:
help_for_sigs(outbuf, partial)
-
- def hdr(s):
- print '\n', s, '\n', '=' * len(s)
-
- hdr('Monitor commands:')
partial = ' '.join(args)
- parser.print_help()
- print '\n'
-
if (cluster_handle.state == "connected"):
help_for_target(target=('mon', ''), partial=partial)
-
return 0
DONTSPLIT = string.letters + '{[<>]}'
@@ -579,6 +577,12 @@ def main():
print >> sys.stderr, '"{0} tell" is deprecated; try "tell {0}.<id>" instead (id can be "*") '.format(childargs[0])
return 1
+ if parsed_args.help:
+ do_basic_help(parser, childargs)
+
+ hdr('Monitor commands:')
+ print '[Contacting monitor, timeout after %d seconds]' % timeout
+
try:
cluster_handle.connect()
except KeyboardInterrupt:
@@ -590,7 +594,7 @@ def main():
return 1
if parsed_args.help:
- return do_help(parser, childargs)
+ return do_extended_help(parser, childargs)
# implement -w/--watch_*
# This is ugly, but Namespace() isn't quite rich enough.