From: Kefu Chai Date: Sun, 28 Jun 2020 11:59:24 +0000 (+0800) Subject: qa/tasks/barbican: drop six dependency X-Git-Tag: v16.1.0~1844^2~14 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8f12c67ba531d0514e56b075d9f63d157b38251f;p=ceph.git qa/tasks/barbican: drop six dependency Signed-off-by: Kefu Chai --- diff --git a/qa/tasks/barbican.py b/qa/tasks/barbican.py index 46b036ef4ce..5df8bad93dc 100644 --- a/qa/tasks/barbican.py +++ b/qa/tasks/barbican.py @@ -4,11 +4,11 @@ Deploy and configure Barbican for Teuthology import argparse import contextlib import logging -import six -from six.moves import http_client -from six.moves.urllib.parse import urlparse +import http import json +from urllib.parse import urlparse + from teuthology import misc as teuthology from teuthology import contextutil from teuthology.orchestra import run @@ -251,7 +251,7 @@ def create_secrets(ctx, config): port=barbican_port) log.info("barbican_url=%s", barbican_url) #fetching user_id of user that gets secrets for radosgw - token_req = http_client.HTTPConnection(keystone_host, keystone_port, timeout=30) + token_req = http.client.HTTPConnection(keystone_host, keystone_port, timeout=30) token_req.request( 'POST', '/v3/auth/tokens', @@ -281,7 +281,7 @@ def create_secrets(ctx, config): rgw_access_user_resp.status < 300): raise Exception("Cannot authenticate user "+rgw_user["username"]+" for secret creation") # baru_resp = json.loads(baru_req.data) - rgw_access_user_data = json.loads(six.ensure_str(rgw_access_user_resp.read())) + rgw_access_user_data = json.loads(rgw_access_user_resp.read().decode()) rgw_user_id = rgw_access_user_data['token']['user']['id'] if 'secrets' in cconfig: for secret in cconfig['secrets']: @@ -296,7 +296,7 @@ def create_secrets(ctx, config): if 'password' not in secret: raise ConfigError('barbican.secrets must have "password" field') - token_req = http_client.HTTPConnection(keystone_host, keystone_port, timeout=30) + token_req = http.client.HTTPConnection(keystone_host, keystone_port, timeout=30) token_req.request( 'POST', '/v3/auth/tokens', @@ -340,7 +340,7 @@ def create_secrets(ctx, config): "payload_content_encoding": "base64" }) - sec_req = http_client.HTTPConnection(barbican_host, barbican_port, timeout=30) + sec_req = http.client.HTTPConnection(barbican_host, barbican_port, timeout=30) try: sec_req.request( 'POST', @@ -358,7 +358,7 @@ def create_secrets(ctx, config): if not (barbican_sec_resp.status >= 200 and barbican_sec_resp.status < 300): raise Exception("Cannot create secret") - barbican_data = json.loads(six.ensure_str(barbican_sec_resp.read())) + barbican_data = json.loads(barbican_sec_resp.read().decode()) if 'secret_ref' not in barbican_data: raise ValueError("Malformed secret creation response") secret_ref = barbican_data["secret_ref"] @@ -371,7 +371,7 @@ def create_secrets(ctx, config): "project-access": True } }) - acl_req = http_client.HTTPConnection(secret_url_parsed.netloc, timeout=30) + acl_req = http.client.HTTPConnection(secret_url_parsed.netloc, timeout=30) acl_req.request( 'PUT', secret_url_parsed.path+'/acl',