]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/tasks/radosgw_admin.py: coerce key.name and key.acl to str
authorKefu Chai <kchai@redhat.com>
Mon, 6 Apr 2020 16:51:12 +0000 (00:51 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 3 Jun 2020 11:56:59 +0000 (19:56 +0800)
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 <kchai@redhat.com>
(cherry picked from commit 96ed9c87c0ca336d13b3da81bc26484426e24f28)

qa/tasks/radosgw_admin.py

index 738e1fe04895c2852a670959412ea8321d510146..13b926a53fae9bf9e53fe01019e05f49fe756d72 100644 (file)
@@ -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(
@@ -746,7 +746,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)
@@ -759,7 +759,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)