clan-cli: Fix clan install command and multiple other issues

This commit is contained in:
Qubasa
2024-12-18 15:29:08 +01:00
parent 695ec0b71c
commit a452cc1a02
5 changed files with 65 additions and 47 deletions

View File

@@ -207,14 +207,14 @@ class Host:
def is_ssh_reachable(host: Host) -> bool:
sock = socket.socket(
with socket.socket(
socket.AF_INET6 if ":" in host.host else socket.AF_INET, socket.SOCK_STREAM
)
sock.settimeout(2)
try:
sock.connect((host.host, host.port or 22))
sock.close()
except OSError:
return False
else:
return True
) as sock:
sock.settimeout(2)
try:
sock.connect((host.host, host.port or 22))
sock.close()
except OSError:
return False
else:
return True