Skip to content

Commit

Permalink
Issue with throwing the correct error
Browse files Browse the repository at this point in the history
  • Loading branch information
PawelPlesniak committed Oct 23, 2024
1 parent 2b7d9ac commit 8c263f4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/drunc/apps/__main_ssh_validator__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ def validate_config(confiuguration_filename:str, session_name:str):
if segment_application not in session_dal.disabled: # If it is not disabled
hosts.add(segment_application.runs_on.runs_on.id)

hosts.add("abc12") # case to throw, not throwing as expected
ssh = Command('/usr/bin/ssh')
runnning_tunnels = []
failed_hosts = []

for host in hosts:
user_host = f"{getpass.getuser()}@{host}"
ssh_args = [user_host, "sleep 2s; exit;"]
Expand All @@ -39,10 +41,11 @@ def validate_config(confiuguration_filename:str, session_name:str):
_preexec_fn = on_parent_exit(signal.SIGTERM) if not macos else None
)
)
except Exception as e:
print(f"Failed to SSH onto host {user_host}, with error {str(e)}")
except sh.ErrorReturnCode_255:
print(f"Failed to SSH onto host {user_host}")
failed_hosts.append(host)
continue

for tunnel in runnning_tunnels:
tunnel.wait(timeout=10)

Expand Down

0 comments on commit 8c263f4

Please sign in to comment.