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 <kchai@redhat.com>
This commit is contained in:
Kefu Chai 2020-12-15 22:55:41 +08:00
parent 32921b7003
commit caba1beaf9
2 changed files with 6 additions and 2 deletions

View File

@ -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

View File

@ -28,6 +28,7 @@
[--format plain|json|json-pretty]
dump variables in plain text, json or pretty
json
[--pid <pid>] Override the $pid when expanding options
If there is no action given, the action will default to --lookup.