!903 修复ipv6升级失败

Merge pull request !903 from 赵晨/master
This commit is contained in:
opengauss_bot 2024-09-11 14:12:53 +00:00 committed by Gitee
commit db44d27d96
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -143,6 +143,8 @@ class LocalRemoteCmd(object):
if not SecurityChecker.check_is_ip(remote_host):
remote_host = HostsUtil.hostname_to_ip(remote_host)
if copy_to:
if NetUtil.get_ip_version(remote_host) == NetUtil.NET_IPV6:
remote_host = "[" + remote_host + "]"
cmd = "%s;pscp --trace-id %s %s -H %s %s %s " % \
(ENV_SOURCE_CMD, trace_id, opts.strip(), remote_host, src, dest)
return cmd
@ -154,6 +156,8 @@ class LocalRemoteCmd(object):
remote_host = HostsUtil.hostname_to_ip(remote_host)
if not SecurityChecker.check_is_ip(localhost):
localhost = HostsUtil.hostname_to_ip(localhost)
if NetUtil.get_ip_version(localhost) == NetUtil.NET_IPV6:
localhost = "[" + localhost + "]"
return "%s;pssh --trace-id %s -s -H %s \" pscp %s -H %s %s %s \" " % \
(ENV_SOURCE_CMD, trace_id, remote_host, opts.strip(), localhost, src, dest)