From fa0a23a7517e9b1a51ca059cf36993a4b9329982 Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Tue, 28 Jan 2020 14:00:41 -0800 Subject: [PATCH] Pass Gerrit not GerritConnection to GerritWatcher We want to call addEvent on the 'gerrit' arg passed to GerritWatcher. For that to work it needs to be of type Gerrit not GerritConnection. Update the location of username, port, etc data to the connection details in the gerrit object. Change-Id: Ic739ddc970f6761f5587ab8fcba3e619a98a4379 --- gerritlib/gerrit.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gerritlib/gerrit.py b/gerritlib/gerrit.py index 0cba3c3..eb8e17a 100644 --- a/gerritlib/gerrit.py +++ b/gerritlib/gerrit.py @@ -118,10 +118,10 @@ class GerritWatcher(threading.Thread): """ super(GerritWatcher, self).__init__() self.connection = GerritConnection( - username or gerrit.username, - hostname or gerrit.hostname, - port or gerrit.port, - keyfile or gerrit.keyfile, + username or gerrit.connection.username, + hostname or gerrit.connection.hostname, + port or gerrit.connection.port, + keyfile or gerrit.connection.keyfile, connection_attempts, retry_delay ) @@ -202,7 +202,7 @@ class Gerrit(object): def startWatching(self, connection_attempts=-1, retry_delay=5): self.event_queue = six.moves.queue.Queue() - watcher = GerritWatcher(self.connection, + watcher = GerritWatcher(self, connection_attempts=connection_attempts, retry_delay=retry_delay) self.watcher_thread = watcher