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
This commit is contained in:
Clark Boylan 2020-01-28 14:00:41 -08:00
parent d244a41362
commit fa0a23a751
1 changed files with 5 additions and 5 deletions

View File

@ -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