diff options
author | Sage Weil <sage@inktank.com> | 2013-10-22 11:23:28 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-10-22 12:34:41 -0700 |
commit | e9224755e2152eaf9c45b7420d9ae26b20f4e5c3 (patch) | |
tree | 505dfff46a6a2d27c70ca208586190c36c0cd8bd | |
parent | 445e8c9860d24aba1210382f3854e9cd25260603 (diff) | |
download | ceph-e9224755e2152eaf9c45b7420d9ae26b20f4e5c3.tar.gz |
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>
-rwxr-xr-x | src/ceph.in | 26 |
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. |