diff options
author | David Pursehouse <david.pursehouse@sonymobile.com> | 2012-09-04 11:28:43 +0900 |
---|---|---|
committer | David Pursehouse <david.pursehouse@sonymobile.com> | 2012-09-04 11:31:15 +0900 |
commit | ce372a4808dfaad89cad6f74d7c618ae2c5a2111 (patch) | |
tree | 2e1e41095abb1644f2129883a1ce093dc29f1724 | |
parent | 424415197211d32eaeb84630542bcab3cc6521b0 (diff) | |
download | pygerrit-ce372a4808dfaad89cad6f74d7c618ae2c5a2111.tar.gz |
Handle invalid port in ssh config
Raise an exception if the ssh config specifies an invalid ssh
port number.
Change-Id: I64fae04c91838a0f9c478ac9de19973e1499ed7e
-rw-r--r-- | pygerrit/ssh.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/pygerrit/ssh.py b/pygerrit/ssh.py index 35de375..f6310a0 100644 --- a/pygerrit/ssh.py +++ b/pygerrit/ssh.py @@ -34,8 +34,12 @@ class GerritSSHClient(SSHClient): if not isfile(key_filename): raise GerritError("Identity file '%s' does not exist" % key_filename) + try: + port = int(data['port']) + except ValueError: + raise GerritError("Invalid port: %s" % data['port']) self.connect(hostname=data['hostname'], - port=int(data['port']), + port=port, username=data['user'], key_filename=key_filename) |