From cd50024eca3e653bfe2762186cc9e36ac98b9e2c Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Sun, 5 Apr 2020 18:35:42 +0800 Subject: [PATCH] qa/tasks: use StringIO for capturing string output see d8d44ed1566b19eec055e07da2a0fed88fed4152 Signed-off-by: Kefu Chai (cherry picked from commit 8bfe977854686149c74de3ebaed7b571d43404dd) Conflicts: qa/tasks/ceph_manager.py qa/tasks/cephadm.py: trivial resolutions --- qa/tasks/ceph_manager.py | 9 +++++---- qa/tasks/watch_notify_same_primary.py | 6 +++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/qa/tasks/ceph_manager.py b/qa/tasks/ceph_manager.py index 0809996fca200..6b1a89be35bec 100644 --- a/qa/tasks/ceph_manager.py +++ b/qa/tasks/ceph_manager.py @@ -15,6 +15,7 @@ import traceback import os from io import BytesIO +from six import StringIO from teuthology import misc as teuthology from tasks.scrub import Scrubber from tasks.util.rados import cmd_erasure_code_profile @@ -1201,7 +1202,7 @@ class CephManager: if watch_channel is not None: args.append("--watch-channel") args.append(watch_channel) - return self.controller.run(args=args, wait=False, stdout=BytesIO(), stdin=run.PIPE) + return self.controller.run(args=args, wait=False, stdout=StringIO(), stdin=run.PIPE) def flush_pg_stats(self, osds, no_wait=None, wait_for_mon=300): """ @@ -1337,7 +1338,7 @@ class CephManager: def osd_admin_socket(self, osd_id, command, check_status=True, timeout=0, stdout=None): if stdout is None: - stdout = BytesIO() + stdout = StringIO() return self.admin_socket('osd', osd_id, command, check_status, timeout, stdout) def find_remote(self, service_type, service_id): @@ -1361,7 +1362,7 @@ class CephManager: to the admin socket """ if stdout is None: - stdout = BytesIO() + stdout = StringIO() testdir = teuthology.get_testdir(self.ctx) remote = self.find_remote(service_type, service_id) args = [ @@ -1477,7 +1478,7 @@ class CephManager: five seconds and try again. """ if stdout is None: - stdout = BytesIO() + stdout = StringIO() tries = 0 while True: proc = self.admin_socket(service_type, service_id, diff --git a/qa/tasks/watch_notify_same_primary.py b/qa/tasks/watch_notify_same_primary.py index 7160979119b38..7c034961c3824 100644 --- a/qa/tasks/watch_notify_same_primary.py +++ b/qa/tasks/watch_notify_same_primary.py @@ -2,7 +2,7 @@ """ watch_notify_same_primary task """ -from io import BytesIO +from six import StringIO import contextlib import logging @@ -68,8 +68,8 @@ def task(ctx, config): "watch", obj(n)], stdin=run.PIPE, - stdout=BytesIO(), - stderr=BytesIO(), + stdout=StringIO(), + stderr=StringIO(), wait=False) return proc -- 2.39.5