Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix ssh localhost ip #314

Merged
merged 10 commits into from
Jul 10, 2024
6 changes: 5 additions & 1 deletion common/ssh_client/ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ def __init__(self, context=None, node=None):
raise Exception("SshHelper init error: node is None")
self.node = node
self.context = context
self.stdio = None
if self.context is not None:
self.stdio = self.context.stdio
self.ssh_type = node.get("ssh_type") or "remote"
self.client = None
self.init()
Expand All @@ -41,7 +44,8 @@ def local_ip(self):
for address in addresses:
local_ip_list.append(address[4][0])
except Exception as e:
self.stdio.watn("get local ip warn: {} . Set local_ip is 127.0.0.1".format(e))
if self.stdio is not None:
self.stdio.warn("get local ip warn: {} . Set local_ip Is 127.0.0.1".format(e))
local_ip_list.append('127.0.0.1')
return list(set(local_ip_list))

Expand Down
Loading