]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/tasks/keystone: get rid of cStringIO for py3
authorKyr Shatskyy <kyrylo.shatskyy@suse.com>
Fri, 21 Feb 2020 19:15:44 +0000 (20:15 +0100)
committerKefu Chai <kchai@redhat.com>
Wed, 3 Jun 2020 11:57:01 +0000 (19:57 +0800)
Signed-off-by: Kyr Shatskyy <kyrylo.shatskyy@suse.com>
(cherry picked from commit dcf85e4328bfba057d30b6720f6e641dacb11e9f)

qa/tasks/keystone.py

index b03471b361ac8744b6f29a30233513b5699ba7c9..76ac347dfd462422f9f60f6d0aec906b695f500c 100644 (file)
@@ -4,7 +4,6 @@ Deploy and configure Keystone for Teuthology
 import argparse
 import contextlib
 import logging
-from cStringIO import StringIO
 
 from teuthology import misc as teuthology
 from teuthology import contextutil
@@ -27,11 +26,9 @@ def run_in_keystone_dir(ctx, client, args, **kwargs):
 def get_toxvenv_dir(ctx):
     return ctx.tox.venv_path
 
-def run_in_tox_venv(ctx, remote, args, **kwargs):
-    return remote.run(
-        args=[ 'source', '{}/bin/activate'.format(get_toxvenv_dir(ctx)), run.Raw('&&') ] + args,
-        **kwargs
-    )
+def toxvenv_sh(ctx, remote, args, **kwargs):
+    activate = get_toxvenv_dir(ctx) + '/bin/activate'
+    return remote.sh(['source', activate, run.Raw('&&')] + args, **kwargs)
 
 def run_in_keystone_venv(ctx, client, args):
     run_in_keystone_dir(ctx, client,
@@ -106,12 +103,10 @@ def install_packages(ctx, config):
     for (client, _) in config.items():
         (remote,) = ctx.cluster.only(client).remotes.keys()
         # use bindep to read which dependencies we need from keystone/bindep.txt
-        run_in_tox_venv(ctx, remote, ['pip', 'install', 'bindep'])
-        r = run_in_tox_venv(ctx, remote,
+        toxvenv_sh(ctx, remote, ['pip', 'install', 'bindep'])
+        packages[client] = toxvenv_sh(ctx, remote,
                 ['bindep', '--brief', '--file', '{}/bindep.txt'.format(get_keystone_dir(ctx))],
-                stdout=StringIO(),
-                check_status=False) # returns 1 on success?
-        packages[client] = r.stdout.getvalue().splitlines()
+                check_status=False).splitlines() # returns 1 on success?
         for dep in packages[client]:
             install_package(dep, remote)
     try: