From 730b6b8bc3697f4294edbf3b73cec47b64c625c0 Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Thu, 12 Sep 2013 18:21:45 +0900 Subject: Fix #10: Allow to manually specify ssh username and port If the username and port are specified when constructing the client, they will be used instead of attempting to fetch from the ssh config file. In this case the full hostname of the server is required, rather than only the name as listed in the ssh config. Change-Id: I82b8638d99922c9b40a54a8275ffc085f505696f --- example.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'example.py') diff --git a/example.py b/example.py index cde021c..904f690 100755 --- a/example.py +++ b/example.py @@ -42,6 +42,11 @@ def _main(): parser.add_option('-g', '--gerrit-hostname', dest='hostname', default='review', help='gerrit server hostname (default: %default)') + parser.add_option('-p', '--port', dest='port', + type='int', default=29418, + help='port number (default: %default)') + parser.add_option('-u', '--username', dest='username', + help='username') parser.add_option('-b', '--blocking', dest='blocking', action='store_true', help='block on event get (default: False)') @@ -65,7 +70,9 @@ def _main(): level=level) try: - gerrit = GerritClient(host=options.hostname) + gerrit = GerritClient(host=options.hostname, + username=options.username, + port=options.port) logging.info("Connected to Gerrit version [%s]", gerrit.gerrit_version()) gerrit.start_event_stream() -- cgit v1.2.1