From 5d56234b454016b775f51800bb0c1343014ede3f Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Sun, 28 Jun 2020 19:45:05 +0800 Subject: [PATCH] qa/tasks/s3tests: drop py2 support Signed-off-by: Kefu Chai --- qa/tasks/s3tests.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/qa/tasks/s3tests.py b/qa/tasks/s3tests.py index c0266b6d2f6..0ebea117371 100644 --- a/qa/tasks/s3tests.py +++ b/qa/tasks/s3tests.py @@ -8,7 +8,6 @@ import contextlib import logging import os import random -import six import string from teuthology import misc as teuthology @@ -82,11 +81,11 @@ def _config_user(s3tests_conf, section, user): s3tests_conf[section].setdefault('access_key', ''.join(random.choice(string.ascii_uppercase) for i in range(20))) s3tests_conf[section].setdefault('secret_key', - six.ensure_str(base64.b64encode(os.urandom(40)))) + base64.b64encode(os.urandom(40)).decode()) s3tests_conf[section].setdefault('totp_serial', ''.join(random.choice(string.digits) for i in range(10))) s3tests_conf[section].setdefault('totp_seed', - six.ensure_str(base64.b32encode(os.urandom(40)))) + base64.b32encode(os.urandom(40)).decode()) s3tests_conf[section].setdefault('totp_seconds', '5') @@ -245,15 +244,15 @@ def configure(ctx, config): log.info('Configuring boto...') boto_src = os.path.join(os.path.dirname(__file__), 'boto.cfg.template') for client, properties in config['clients'].items(): - with open(boto_src, 'rb') as f: + with open(boto_src) as f: (remote,) = ctx.cluster.only(client).remotes.keys() - conf = six.ensure_str(f.read()).format( + conf = f.read().format( idle_timeout=config.get('idle_timeout', 30) ) teuthology.write_file( remote=remote, path='{tdir}/boto.cfg'.format(tdir=testdir), - data=six.ensure_binary(conf), + data=conf.encode(), ) try: -- 2.39.5