Skip to content

Commit

Permalink
ceph: fix external script when passing monitoring list
Browse files Browse the repository at this point in the history
If we call the script with --monitoring-endpoint
10.1.8.29,10.1.8.36,10.1.8.25, we need to parse each comma-separated
address and not the entire block.
Now each address is tested properly.

Signed-off-by: Sébastien Han <seb@redhat.com>
  • Loading branch information
leseb committed Sep 23, 2021
1 parent 4583a80 commit c7f0600
Showing 1 changed file with 15 additions and 12 deletions.
Expand Up @@ -369,9 +369,9 @@ def _convert_hostname_to_ip(self, host_name):

def get_active_and_standby_mgrs(self):
monitoring_endpoint_port = self._arg_parser.monitoring_endpoint_port
monitoring_endpoint_ip = self._arg_parser.monitoring_endpoint
monitoring_endpoint_ip_list = self._arg_parser.monitoring_endpoint
standby_mgrs = []
if not monitoring_endpoint_ip:
if not monitoring_endpoint_ip_list:
cmd_json = {"prefix": "status", "format": "json"}
ret_val, json_out, err_msg = self._common_cmd_json_gen(cmd_json)
# if there is an unsuccessful attempt,
Expand All @@ -394,7 +394,7 @@ def get_active_and_standby_mgrs(self):
except ValueError:
raise ExecutionFailureException(
"invalid endpoint: {}".format(monitoring_endpoint))
monitoring_endpoint_ip = parsed_endpoint.hostname
monitoring_endpoint_ip_list = parsed_endpoint.hostname
if not monitoring_endpoint_port:
monitoring_endpoint_port = "{}".format(parsed_endpoint.port)

Expand All @@ -403,15 +403,18 @@ def get_active_and_standby_mgrs(self):
monitoring_endpoint_port = self.DEFAULT_MONITORING_ENDPOINT_PORT

try:
failed_ip = monitoring_endpoint_ip
monitoring_endpoint_ip = self._convert_hostname_to_ip(
monitoring_endpoint_ip)
# collect all the 'stand-by' mgr ips
mgr_ips = []
for each_standby_mgr in standby_mgrs:
failed_ip = each_standby_mgr
mgr_ips.append(
self._convert_hostname_to_ip(each_standby_mgr))
monitoring_endpoint_ip_list_split = monitoring_endpoint_ip_list.split(
',')
for monitoring_endpoint_ip in monitoring_endpoint_ip_list_split:
failed_ip = monitoring_endpoint_ip
monitoring_endpoint_ip = self._convert_hostname_to_ip(
monitoring_endpoint_ip)
# collect all the 'stand-by' mgr ips
mgr_ips = []
for each_standby_mgr in standby_mgrs:
failed_ip = each_standby_mgr
mgr_ips.append(
self._convert_hostname_to_ip(each_standby_mgr))
except:
raise ExecutionFailureException(
"Conversion of host: {} to IP failed. "
Expand Down

0 comments on commit c7f0600

Please sign in to comment.