From 37783b991f3ac4b163a7f55e494a3997db795f6c Mon Sep 17 00:00:00 2001 From: Alfredo Deza Date: Mon, 17 Jul 2017 15:16:25 -0400 Subject: [PATCH] ceph-volume: process: decode non-str streams from subprocess Signed-off-by: Alfredo Deza --- src/ceph-volume/ceph_volume/process.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/ceph-volume/ceph_volume/process.py b/src/ceph-volume/ceph_volume/process.py index 7ba14da7297..5008bc490c2 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 -- 2.39.5