From 9e94fbcd20ee59bbf280eb8687d502956b26fe4c Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Tue, 16 Oct 2012 17:09:40 +0900 Subject: Move SSH client from stream class to main client class So it can be reused in query functionality that will be added later. Change-Id: I361aaf8fe8aa9107a94757606a3a1837b6a448ab --- pygerrit/stream.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'pygerrit/stream.py') diff --git a/pygerrit/stream.py b/pygerrit/stream.py index d324422..f9ad55e 100644 --- a/pygerrit/stream.py +++ b/pygerrit/stream.py @@ -30,7 +30,6 @@ import json from select import poll, POLLIN from threading import Thread, Event -from pygerrit.ssh import GerritSSHClient from pygerrit.error import GerritError from pygerrit.events import GerritEvent, GerritEventFactory @@ -49,11 +48,11 @@ class GerritStream(Thread): """ Gerrit events stream handler. """ - def __init__(self, gerrit, host): + def __init__(self, gerrit, ssh_client): Thread.__init__(self) self.daemon = True self._gerrit = gerrit - self._host = host + self._ssh_client = ssh_client self._stop = Event() def stop(self): @@ -63,8 +62,8 @@ class GerritStream(Thread): def run(self): """ Listen to the stream and send events to the client. """ try: - client = GerritSSHClient(self._host) - _stdin, stdout, _stderr = client.run_gerrit_command("stream-events") + _stdin, stdout, _stderr = \ + self._ssh_client.run_gerrit_command("stream-events") p = poll() p.register(stdout.channel) while not self._stop.is_set(): -- cgit v1.2.1