From: Kefu Chai Date: Mon, 6 Apr 2020 09:36:18 +0000 (+0800) Subject: qa/tasks/barbican.py: convert to str before json.loads() X-Git-Tag: v15.2.4~42^2~7 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f808e267beaa7ff7d7cd88e02ecf56d33df897d5;p=ceph.git qa/tasks/barbican.py: convert to str before json.loads() in Python3, json.loads() expects a string, while HTTPConnection.getresponse() returns a byte-like object, so we need to coerce it to str first. Signed-off-by: Kefu Chai (cherry picked from commit c79e1e1a525e08d55fd60c2333e8f5d4df603350) --- diff --git a/qa/tasks/barbican.py b/qa/tasks/barbican.py index b6b455e5fc25..46b036ef4ced 100644 --- a/qa/tasks/barbican.py +++ b/qa/tasks/barbican.py @@ -4,6 +4,7 @@ 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 json @@ -357,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(barbican_sec_resp.read()) + barbican_data = json.loads(six.ensure_str(barbican_sec_resp.read())) if 'secret_ref' not in barbican_data: raise ValueError("Malformed secret creation response") secret_ref = barbican_data["secret_ref"]