From 63a9ddc57ff1b90e61238a4abec3e87cd5084639 Mon Sep 17 00:00:00 2001 From: Jos Collin Date: Thu, 18 Jun 2020 11:39:03 +0530 Subject: [PATCH] qa/tasks: make sh() in vstart_runner.py identical with teuthology.orchestra.remote.sh Fixes: https://tracker.ceph.com/issues/46069 Signed-off-by: Jos Collin --- qa/tasks/vstart_runner.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/qa/tasks/vstart_runner.py b/qa/tasks/vstart_runner.py index 110932cf45832..1a7a5e210a8ea 100644 --- a/qa/tasks/vstart_runner.py +++ b/qa/tasks/vstart_runner.py @@ -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): -- 2.39.5