]> 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>
Sun, 14 Jun 2020 08:34:52 +0000 (16:34 +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 7f74691d15e7bcb2dfbab0baa0cff1e43705815e..27e38cb26e1be9c649d85685124a6d13f95acc6b 100644 (file)
@@ -244,7 +244,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(
@@ -799,7 +799,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)
@@ -812,7 +812,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)