From 11073e505fa115ee30f6ea2d8b8e1538802eb93a Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Tue, 21 Feb 2012 12:23:38 -0800 Subject: [PATCH] s3roundtrip, s3readwrite: access key uses url safe chars Signed-off-by: Yehuda Sadeh --- teuthology/task/s3readwrite.py | 3 ++- teuthology/task/s3roundtrip.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/teuthology/task/s3readwrite.py b/teuthology/task/s3readwrite.py index 3739bf04bb233..658799413b920 100644 --- a/teuthology/task/s3readwrite.py +++ b/teuthology/task/s3readwrite.py @@ -4,6 +4,7 @@ import contextlib import logging import os import yaml +import random from teuthology import misc as teuthology from teuthology import contextutil @@ -43,7 +44,7 @@ def _config_user(s3tests_conf, section, user): s3tests_conf[section].setdefault('user_id', user) s3tests_conf[section].setdefault('email', '{user}+test@test.test'.format(user=user)) s3tests_conf[section].setdefault('display_name', 'Mr. {user}'.format(user=user)) - s3tests_conf[section].setdefault('access_key', base64.b64encode(os.urandom(20))) + s3tests_conf[section].setdefault('access_key', ''.join(random.choice(string.uppercase) for i in xrange(20))) s3tests_conf[section].setdefault('secret_key', base64.b64encode(os.urandom(40))) @contextlib.contextmanager diff --git a/teuthology/task/s3roundtrip.py b/teuthology/task/s3roundtrip.py index 32c666b7df132..15cf4fbe2100b 100644 --- a/teuthology/task/s3roundtrip.py +++ b/teuthology/task/s3roundtrip.py @@ -4,6 +4,7 @@ import contextlib import logging import os import yaml +import random from teuthology import misc as teuthology from teuthology import contextutil @@ -43,7 +44,7 @@ def _config_user(s3tests_conf, section, user): s3tests_conf[section].setdefault('user_id', user) s3tests_conf[section].setdefault('email', '{user}+test@test.test'.format(user=user)) s3tests_conf[section].setdefault('display_name', 'Mr. {user}'.format(user=user)) - s3tests_conf[section].setdefault('access_key', base64.b64encode(os.urandom(20))) + s3tests_conf[section].setdefault('access_key', ''.join(random.choice(string.uppercase) for i in xrange(20))) s3tests_conf[section].setdefault('secret_key', base64.b64encode(os.urandom(40))) @contextlib.contextmanager -- 2.39.5