summaryrefslogtreecommitdiff
path: root/pygerrit/stream.py
diff options
context:
space:
mode:
authorDavid Pursehouse <david.pursehouse@sonymobile.com>2012-10-16 17:09:40 +0900
committerDavid Pursehouse <david.pursehouse@sonymobile.com>2012-10-16 17:09:40 +0900
commit9e94fbcd20ee59bbf280eb8687d502956b26fe4c (patch)
tree8d1c495ae39a511a3ec41d919c104c017a699652 /pygerrit/stream.py
parentfa27eb4280e2218caf50b9e613fa46335cdc2a13 (diff)
downloadpygerrit-9e94fbcd20ee59bbf280eb8687d502956b26fe4c.tar.gz
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
Diffstat (limited to 'pygerrit/stream.py')
-rw-r--r--pygerrit/stream.py9
1 files changed, 4 insertions, 5 deletions
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():