From a495d7431b3494bc061be62868d2acbf03aa0864 Mon Sep 17 00:00:00 2001 From: Kyr Shatskyy Date: Sat, 15 Feb 2020 03:51:46 +0100 Subject: [PATCH] qa/tasks/rbd: get rid of cStringIO for py3 Use io.BytesIO and six.ensure_str for py3 compatibility instead of cStringIO.StringIO Signed-off-by: Kyr Shatskyy (cherry picked from commit 7b72097cd1cf93f5445483802344327f1e3da0bc) --- qa/tasks/rbd.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/qa/tasks/rbd.py b/qa/tasks/rbd.py index ee30e02c43591..d43672b971444 100644 --- a/qa/tasks/rbd.py +++ b/qa/tasks/rbd.py @@ -7,7 +7,7 @@ import os import tempfile import sys -from cStringIO import StringIO +from io import BytesIO from teuthology.orchestra import run from teuthology import misc as teuthology from teuthology import contextutil @@ -303,12 +303,12 @@ def canonical_path(ctx, role, path): representing the given role. A canonical path contains no . or .. components, and includes no symbolic links. """ - version_fp = StringIO() + version_fp = BytesIO() ctx.cluster.only(role).run( args=[ 'readlink', '-f', path ], stdout=version_fp, ) - canonical_path = version_fp.getvalue().rstrip('\n') + canonical_path = six.ensure_str(version_fp.getvalue()).rstrip('\n') version_fp.close() return canonical_path -- 2.39.5