]> git.apps.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>
Tue, 7 Apr 2020 13:51:23 +0000 (21:51 +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>
qa/tasks/radosgw_admin.py

index 2cc85865fbc99a34f41f5df57195ae3c4c5c02f6..092d83fd8e262fc3c12e1fbd1d06b75230e691c6 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(
@@ -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)