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

orchestra: Tolerate EOFError during connect #1887

Merged
merged 2 commits into from
Oct 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions teuthology/orchestra/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,23 +96,23 @@ def connect(user_at_host, host_key=None, keep_alive=False, timeout=60,

log.debug(connect_args)

try:
if not retry:
ssh.connect(**connect_args)
else:
# Retries are implemented using safe_while
with safe_while(sleep=1, action='connect to ' + host) as proceed:
while proceed():
if not retry:
ssh.connect(**connect_args)
else:
with safe_while(sleep=1, increment=3, action='connect to ' + host) as proceed:
while proceed():
auth_err_msg = f"Error authenticating with {host}"
try:
ssh.connect(**connect_args)
break
except paramiko.AuthenticationException as e:
log.error(f"Error authenticating with {host}: {str(e)}")
except paramiko.SSHException:
msg = f"Error authenticating with {host}"
if not key_filename:
log.error(msg + ": No SSH private key found!")
raise
else:
log.exception(msg)
except EOFError:
log.error(f"{auth_err_msg}: EOFError")
except paramiko.AuthenticationException as e:
log.error(f"{auth_err_msg}: {repr(e)}")
except paramiko.SSHException as e:
auth_err_msg = f"{auth_err_msg}: {repr(e)}"
if not key_filename:
auth_err_msg = f"{auth_err_msg} (No SSH private key found!)"
log.exception(auth_err_msg)
ssh.get_transport().set_keepalive(keep_alive)
return ssh
Loading