]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
qa/tasks/rbd: get rid of cStringIO for py3
authorKyr Shatskyy <kyrylo.shatskyy@suse.com>
Sat, 15 Feb 2020 02:51:46 +0000 (03:51 +0100)
committerKyr Shatskyy <kyrylo.shatskyy@suse.com>
Fri, 6 Mar 2020 09:19:55 +0000 (10:19 +0100)
Use io.BytesIO and six.ensure_str for py3 compatibility
instead of cStringIO.StringIO

Signed-off-by: Kyr Shatskyy <kyrylo.shatskyy@suse.com>
qa/tasks/rbd.py

index faa094dabebbdb7c6aa4d8bd9278b80291f5489a..c690dcfe582b095957822a5c7c0156454480683b 100644 (file)
@@ -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