summaryrefslogtreecommitdiff
path: root/example.py
diff options
context:
space:
mode:
authorDavid Pursehouse <david.pursehouse@sonymobile.com>2013-09-12 18:21:45 +0900
committerDavid Pursehouse <david.pursehouse@sonymobile.com>2013-09-12 18:21:45 +0900
commit730b6b8bc3697f4294edbf3b73cec47b64c625c0 (patch)
tree6523edb2b9b74fa715351650efdb10fdf235daff /example.py
parent7fc93f60775f252278af535ade9a7c6cae17a3d1 (diff)
downloadpygerrit-730b6b8bc3697f4294edbf3b73cec47b64c625c0.tar.gz
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
Diffstat (limited to 'example.py')
-rwxr-xr-xexample.py9
1 files changed, 8 insertions, 1 deletions
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()