From: Dan Mick Date: Thu, 6 Jun 2013 01:17:26 +0000 (-0700) Subject: ceph: catch/handle exceptions in admin socket commands X-Git-Tag: v0.65~136^2^2~10 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b1588bd4775a7c91d77a474651978ae706c665c6;p=ceph.git ceph: catch/handle exceptions in admin socket commands Signed-off-by: Dan Mick --- diff --git a/src/ceph b/src/ceph index 3396c70e0b94..f11ad997370b 100755 --- a/src/ceph +++ b/src/ceph @@ -1322,18 +1322,27 @@ def main(): # For now, --admin-daemon is handled as usual. Try it # first in case we can't connect() to the cluster if parsed_args.admin_socket: - print admin_socket(parsed_args.admin_socket, childargs) + try: + print admin_socket(parsed_args.admin_socket, childargs) + except Exception as e: + print >> sys.stderr, 'admin_socket: {0}'.format(e) return 0 if len(childargs) > 0 and childargs[0] == "daemon": if len(childargs) > 2: if childargs[1].find('/') >= 0: - print admin_socket(childargs[1], childargs[2:]) + try: + print admin_socket(childargs[1], childargs[2:]) + except Exception as e: + print >> sys.stderr, 'admin_socket: {0}'.format(e) return 0 else: # try resolve daemon name path = ceph_conf('admin_socket', childargs[1]) - print admin_socket(path, childargs[2:]) + try: + print admin_socket(path, childargs[2:]) + except Exception as e: + print >> sys.stderr, 'admin_socket: {0}'.format(e) return 0 else: print >> sys.stderr, 'Daemon requires at least 2 arguments'