From: Kefu Chai Date: Tue, 15 Dec 2020 14:55:41 +0000 (+0800) Subject: ceph.in: extract get_admin_socket() out X-Git-Tag: v16.1.0~221^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=caba1beaf90896ac42b63fe34e646089cb5dfb00;p=ceph.git ceph.in: extract get_admin_socket() out will add retry support to this function, so we can use an alternative name for the admin_socket path if the path is not a valid file. Signed-off-by: Kefu Chai --- diff --git a/src/ceph.in b/src/ceph.in index 9d535eb842a2..2ee2f3d6c2ef 100755 --- a/src/ceph.in +++ b/src/ceph.in @@ -730,6 +730,10 @@ def ping_monitor(cluster_handle, name, timeout): return 0 +def get_admin_socket(parsed_args, name): + return ceph_conf(parsed_args, 'admin_socket', name) + + def maybe_daemon_command(parsed_args, childargs): """ Check if --admin-socket, daemon, or daemonperf command @@ -751,8 +755,7 @@ def maybe_daemon_command(parsed_args, childargs): else: # try resolve daemon name try: - sockpath = ceph_conf(parsed_args, 'admin_socket', - childargs[1]) + sockpath = get_admin_socket(parsed_args, childargs[1]) except Exception as e: print('Can\'t get admin socket path: ' + str(e), file=sys.stderr) return True, errno.EINVAL diff --git a/src/test/cli/ceph-conf/help.t b/src/test/cli/ceph-conf/help.t index 8fa2152d3949..751b3a54ae9b 100644 --- a/src/test/cli/ceph-conf/help.t +++ b/src/test/cli/ceph-conf/help.t @@ -28,6 +28,7 @@ [--format plain|json|json-pretty] dump variables in plain text, json or pretty json + [--pid ] Override the $pid when expanding options If there is no action given, the action will default to --lookup.