]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/tasks/ragweed.py: use str methods of helper from string module
authorKefu Chai <kchai@redhat.com>
Mon, 6 Apr 2020 07:12:46 +0000 (15:12 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 3 Jun 2020 11:56:59 +0000 (19:56 +0800)
in Python3, some methods offered by `string` module are now member
method of `str` class, and `string.uppercase` is renamed to
`string.ascii_uppercase` in Python2 and Python3. so let's update
accordingly.

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 6ad2ca9767fde8d6c8ce68035f34f93a4594fd4a)

qa/tasks/ragweed.py

index 50ead75a8c660c372c0a0988cd31dd9e82bd7b35..624c81737f37bb0699e1d685cb106632c730d84d 100644 (file)
@@ -101,7 +101,7 @@ def _config_user(ragweed_conf, section, user):
     ragweed_conf[section].setdefault('user_id', user)
     ragweed_conf[section].setdefault('email', '{user}+test@test.test'.format(user=user))
     ragweed_conf[section].setdefault('display_name', 'Mr. {user}'.format(user=user))
-    ragweed_conf[section].setdefault('access_key', ''.join(random.choice(string.uppercase) for i in range(20)))
+    ragweed_conf[section].setdefault('access_key', ''.join(random.choice(string.ascii_uppercase) for i in range(20)))
     ragweed_conf[section].setdefault('secret_key', base64.b64encode(os.urandom(40)))
 
 
@@ -113,7 +113,7 @@ def create_users(ctx, config, run_stages):
     assert isinstance(config, dict)
 
     for client, properties in config['config'].items():
-        run_stages[client] = string.split(properties.get('stages', 'prepare,check'), ',')
+        run_stages[client] = properties.get('stages', 'prepare,check').split(',')
 
     log.info('Creating rgw users...')
     testdir = teuthology.get_testdir(ctx)
@@ -261,7 +261,7 @@ def run_tests(ctx, config, run_stages):
     testdir = teuthology.get_testdir(ctx)
     attrs = ["!fails_on_rgw"]
     for client, client_config in config.items():
-        stages = string.join(run_stages[client], ',')
+        stages = ','.join(run_stages[client])
         args = [
             'RAGWEED_CONF={tdir}/archive/ragweed.{client}.conf'.format(tdir=testdir, client=client),
             'RAGWEED_STAGES={stages}'.format(stages=stages),