Switch RootHelperProcess from select.poll to select.select

The new eventlet 0.20.x that the gate was recently bumped to [1] removed
select.poll [2]. Instead, we should use select.select that is both
supported by eventlet as well as available on all platforms.

[1] I534b8d7d6c2fa00c1fa7d84b3438e6e2b2fcad9e
[2] http://eventlet.net/doc/changelog.html#id2

Conflicts:
	neutron/tests/common/net_helpers.py

Change-Id: Ie649abf495e00e7e05de47520ed89bbcd28360db
Closes-Bug: #1674557
(cherry picked from commit f48dbeda5c)
This commit is contained in:
Ihar Hrachyshka 2017-03-21 05:23:53 +00:00
parent bd7c3a7708
commit 38bca3d74f
1 changed files with 5 additions and 6 deletions

View File

@ -253,12 +253,11 @@ class RootHelperProcess(subprocess.Popen):
@staticmethod
def _read_stream(stream, timeout):
if timeout:
poller = select.poll()
poller.register(stream.fileno())
poll_predicate = functools.partial(poller.poll, 1)
utils.wait_until_true(poll_predicate, timeout, 0.1,
RuntimeError(
'No output in %.2f seconds' % timeout))
poll_predicate = functools.partial(
select.select, [stream], [], [], 1)
utils.wait_until_true(
lambda: poll_predicate()[0], timeout, 0.1,
RuntimeError('No output in %.2f seconds' % timeout))
return stream.readline()
def writeline(self, data):