apply TRY lint

This commit is contained in:
Jörg Thalheim
2024-09-03 17:56:59 +02:00
parent 850bb3314a
commit 29909e49d3
26 changed files with 70 additions and 49 deletions

View File

@@ -751,7 +751,7 @@ class HostGroup:
"""
threads = []
results: list[HostResult[T]] = [
HostResult(h, Exception(f"No result set for thread {i}"))
HostResult(h, ClanError(f"No result set for thread {i}"))
for (i, h) in enumerate(self.hosts)
]
for i, host in enumerate(self.hosts):
@@ -800,7 +800,7 @@ def parse_deployment_address(
result = urllib.parse.urlsplit("//" + hostname)
if not result.hostname:
msg = f"Invalid hostname: {hostname}"
raise Exception(msg)
raise ClanError(msg)
hostname = result.hostname
port = result.port
meta = meta.copy()

View File

@@ -82,9 +82,10 @@ def is_reachable(host: str) -> bool:
try:
sock.connect((host, 22))
sock.close()
return True
except OSError:
return False
else:
return True
def connect_ssh_from_json(ssh_data: dict[str, str]) -> None: