Skip to content

Commit

Permalink
Fail gracefully if host cannot be reached
Browse files Browse the repository at this point in the history
Log this error
  • Loading branch information
kd8bny committed Nov 9, 2017
1 parent 8d9e7fc commit 979ac87
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ def connect(self):

self.SFTP = self.session.open_sftp()

except paramiko.AuthenticationException as auth_except:
print(colored("{}".format(auth_except), 'red'))
except (paramiko.AuthenticationException,
paramiko.ssh_exception.NoValidConnectionsError) as e:
print(colored("> {}".format(e), 'red'))
self.logger.error(e)
sys.exit()

0 comments on commit 979ac87

Please sign in to comment.