Decode the console log stream
For python 3 compatibility the console log stream must be decoded. Otherwise zuul executor crashes with [1]. [1] Stack trace: Ansible out b'Traceback (most recent call last):' Ansible out b' File "/usr/lib/python3.5/multiprocessing/process.py", line 249, in _bootstrap' Ansible out b' self.run()' Ansible out b' File "/usr/lib/python3.5/multiprocessing/process.py", line 93, in run' Ansible out b' self._target(*self._args, **self._kwargs)' Ansible out b' File "/mnt/zuul/state/ansible/callback/zuul_stream.py", line 98, in _read_log' Ansible output: b' for line in linesplit(s):' Ansible output: b' File "/mnt/zuul/state/ansible/callback/zuul_stream.py", line 30, in linesplit' Ansible output: b' if "\\n" in buff:' Ansible output: b"TypeError: a bytes-like object is required, not 'str'" Ansible output: b'Process Process-8:' Ansible output: b'Traceback (most recent call last):' Ansible output: b' File "/usr/lib/python3.5/multiprocessing/process.py", line 249, in _bootstrap' Ansible output: b' self.run()' Ansible output: b' File "/usr/lib/python3.5/multiprocessing/process.py", line 93, in run' Ansible output: b' self._target(*self._args, **self._kwargs)' Ansible output: b' File "/mnt/zuul/state/ansible/callback/zuul_stream.py", line 98, in _read_log' Ansible output: b' for line in linesplit(s):' Ansible output: b' File "/mnt/zuul/state/ansible/callback/zuul_stream.py", line 30, in linesplit' Ansible output: b' if "\\n" in buff:' Ansible output: b"TypeError: a bytes-like object is required, not 'str'" Change-Id: Ia371562be3f30a5608e901349eda4cea77d7367d
This commit is contained in:
parent
6a22df5f54
commit
329afbe04c
|
@ -24,14 +24,14 @@ LOG_STREAM_PORT = 19885
|
|||
|
||||
|
||||
def linesplit(socket):
|
||||
buff = socket.recv(4096)
|
||||
buff = socket.recv(4096).decode("utf-8")
|
||||
buffering = True
|
||||
while buffering:
|
||||
if "\n" in buff:
|
||||
(line, buff) = buff.split("\n", 1)
|
||||
yield line + "\n"
|
||||
else:
|
||||
more = socket.recv(4096)
|
||||
more = socket.recv(4096).decode("utf-8")
|
||||
if not more:
|
||||
buffering = False
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue