From 1f8a5aade209f5998a405f9a24ee54dd2eb52c57 Mon Sep 17 00:00:00 2001 From: "Zhang Rong(Jon)" Date: Fri, 26 Apr 2024 17:35:04 +0800 Subject: [PATCH] Fix the watcher cannot parse with IPv6 This commit fix the dcmanager client and fmclient parse IPv6 failed. Test Plan: PASS - Connect with IPv6 O-Cloud DC environment PASS - Connect with IPv6 environment which has alarm Issue-ID: INF-455 Change-Id: I5c18a7216b1bce57793bae390a2ccf3cf99f3c73 Signed-off-by: Zhang Rong(Jon) --- o2common/config/config.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/o2common/config/config.py b/o2common/config/config.py index d045315..61c8c69 100644 --- a/o2common/config/config.py +++ b/o2common/config/config.py @@ -193,9 +193,11 @@ def get_dc_access_info(): for key, val in client_args.items(): os_client_args['os_{key}'.format(key=key)] = val auth_url = urlparse(os_client_args.pop('os_auth_url')) + hostname = f"[{auth_url.hostname}]" if is_ipv6(auth_url.hostname) \ + else auth_url.hostname dcmanager_url = urlparse(_DEFAULT_DCMANAGER_URL) dcmanager_url = dcmanager_url._replace(netloc=dcmanager_url.netloc.replace( - dcmanager_url.hostname, auth_url.hostname)) + dcmanager_url.hostname, hostname)) os_client_args['dcmanager_url'] = dcmanager_url.geturl() os_client_args['auth_url'] = auth_url.geturl() @@ -231,6 +233,8 @@ def get_fm_access_info(subcloud_hostname: str = "", os_client_args['auth_url'] = auth_url.geturl() if "" != subcloud_hostname: + subcloud_hostname = f"[{subcloud_hostname}]" if \ + is_ipv6(subcloud_hostname) else subcloud_hostname orig_auth_url = urlparse(_DEFAULT_STX_URL) new_auth_url = orig_auth_url._replace( netloc=orig_auth_url.netloc.replace( -- 2.16.6