]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/tasks: make sh() in vstart_runner.py identical with teuthology.orchestra.remote.sh 35639/head
authorJos Collin <jcollin@redhat.com>
Thu, 18 Jun 2020 06:09:03 +0000 (11:39 +0530)
committerJos Collin <jcollin@redhat.com>
Wed, 1 Jul 2020 12:19:35 +0000 (17:49 +0530)
Fixes: https://tracker.ceph.com/issues/46069
Signed-off-by: Jos Collin <jcollin@redhat.com>
qa/tasks/vstart_runner.py

index 110932cf45832e9ed327358197f9be878c94fb31..1a7a5e210a8ea9f6fe4f7ee10e7ad0c01eb7ee4e 100644 (file)
@@ -430,7 +430,8 @@ class LocalRemote(object):
 
         return proc
 
-    # XXX: for compatibility keep this method same teuthology.orchestra.remote.sh
+    # XXX: for compatibility keep this method same as teuthology.orchestra.remote.sh
+    # BytesIO is being used just to keep things identical
     def sh(self, script, **kwargs):
         """
         Shortcut for run method.
@@ -439,13 +440,18 @@ class LocalRemote(object):
             my_name = remote.sh('whoami')
             remote_date = remote.sh('date')
         """
+        from io import BytesIO
+
         if 'stdout' not in kwargs:
-            kwargs['stdout'] = StringIO()
+            kwargs['stdout'] = BytesIO()
         if 'args' not in kwargs:
             kwargs['args'] = script
         proc = self.run(**kwargs)
-        return proc.stdout.getvalue()
-
+        out = proc.stdout.getvalue()
+        if isinstance(out, bytes):
+            return out.decode()
+        else:
+            return out
 
 class LocalDaemon(object):
     def __init__(self, daemon_type, daemon_id):