]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume: process: decode non-str streams from subprocess
authorAlfredo Deza <adeza@redhat.com>
Mon, 17 Jul 2017 19:16:25 +0000 (15:16 -0400)
committerAlfredo Deza <adeza@redhat.com>
Fri, 4 Aug 2017 14:25:58 +0000 (10:25 -0400)
Signed-off-by: Alfredo Deza <adeza@redhat.com>
src/ceph-volume/ceph_volume/process.py

index 7ba14da72979691677c03f2ca2386360d5f09377..5008bc490c2d91de9feca6271ea0a783f1c301f2 100644 (file)
@@ -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