From: Alfredo Deza Date: Mon, 17 Jul 2017 19:16:25 +0000 (-0400) Subject: ceph-volume: process: decode non-str streams from subprocess X-Git-Tag: ses5-milestone10~3^2~5^2~36 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=37783b991f3ac4b163a7f55e494a3997db795f6c;p=ceph.git ceph-volume: process: decode non-str streams from subprocess Signed-off-by: Alfredo Deza --- diff --git a/src/ceph-volume/ceph_volume/process.py b/src/ceph-volume/ceph_volume/process.py index 7ba14da72979..5008bc490c2d 100644 --- a/src/ceph-volume/ceph_volume/process.py +++ b/src/ceph-volume/ceph_volume/process.py @@ -124,8 +124,14 @@ def call(command, **kw): ) returncode = process.wait() - stdout = process.stdout.read().splitlines() - stderr = process.stderr.read().splitlines() + stdout_stream = process.stdout.read() + stderr_stream = process.stderr.read() + if not isinstance(stdout_stream, str): + stdout_stream = stdout_stream.decode('utf-8') + if not isinstance(stderr_stream, str): + stderr_stream = stderr_stream.decode('utf-8') + stdout = stdout_stream.splitlines() + stderr = stderr_stream.splitlines() # the following can get a messed up order in the log if the system call # returns output with both stderr and stdout intermingled. This separates