From: Kefu Chai Date: Mon, 6 Apr 2020 16:51:12 +0000 (+0800) Subject: qa/tasks/radosgw_admin.py: coerce key.name and key.acl to str X-Git-Tag: wip-pdonnell-testing-20200918.022351~1585^2~11 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=96ed9c87c0ca336d13b3da81bc26484426e24f28;p=ceph-ci.git qa/tasks/radosgw_admin.py: coerce key.name and key.acl to str if `key.name` is not set, boto fills it with md5, in that case, it comes from `base64.b64encode()`. so we need to make sure it's str before passing it to shell. the same applies to `key.get_xml_acl()`, as its return value comes directly from something like ``` response = self.connection.make_request('GET', self.name, key_name, query_args=query_args, headers=headers) body = response.read() # ... return body ``` Signed-off-by: Kefu Chai --- diff --git a/qa/tasks/radosgw_admin.py b/qa/tasks/radosgw_admin.py index 2cc85865fbc..092d83fd8e2 100644 --- a/qa/tasks/radosgw_admin.py +++ b/qa/tasks/radosgw_admin.py @@ -245,7 +245,7 @@ def get_acl(key): Helper function to get the xml acl from a key, ensuring that the xml version tag is removed from the acl response """ - raw_acl = key.get_xml_acl() + raw_acl = six.ensure_str(key.get_xml_acl()) def remove_version(string): return string.split( @@ -800,7 +800,7 @@ def task(ctx, config): rl.log_and_clear("put_acls", bucket_name, user1) (err, out) = rgwadmin(ctx, client, - ['policy', '--bucket', bucket.name, '--object', key.key], + ['policy', '--bucket', bucket.name, '--object', six.ensure_str(key.key)], check_status=True, format='xml') acl = get_acl(key) @@ -813,7 +813,7 @@ def task(ctx, config): rl.log_and_clear("put_acls", bucket_name, user1) (err, out) = rgwadmin(ctx, client, - ['policy', '--bucket', bucket.name, '--object', key.key], + ['policy', '--bucket', bucket.name, '--object', six.ensure_str(key.key)], check_status=True, format='xml') acl = get_acl(key)