From caba1beaf90896ac42b63fe34e646089cb5dfb00 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Tue, 15 Dec 2020 22:55:41 +0800 Subject: [PATCH] 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 --- src/ceph.in | 7 +++++-- src/test/cli/ceph-conf/help.t | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ceph.in b/src/ceph.in index 9d535eb842a21..2ee2f3d6c2ef2 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 8fa2152d3949e..751b3a54ae9ba 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. -- 2.39.5