Skip to content

Commit

Permalink
Improve error handling for unreachable linecard
Browse files Browse the repository at this point in the history
Signed-off-by: Noah Solomon <t-nosolomon@microsoft.com>
  • Loading branch information
noahsolomon-ms committed Aug 9, 2022
1 parent c439e50 commit 41e99b8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion rcli/linecard.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ def __init__(self, linecard_name, username, password_filename=None, use_ssh_keys
self.connection = paramiko.SSHClient()
# if ip address not in known_hosts, ignore known_hosts error
self.connection.set_missing_host_key_policy(paramiko.AutoAddPolicy())
self.connection.connect(self.ip, username=self.username, password=password)
try:
self.connection.connect(self.ip, username=self.username, password=password)
except paramiko.ssh_exception.NoValidConnectionsError as e:
self.connection = None
print(e)

def ssh_copy_id(self, password_filename:str) -> None:
"""
Expand Down

0 comments on commit 41e99b8

Please sign in to comment.