]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
qa/tasks: decode bytes returned by base64.b64encode()
authorKefu Chai <kchai@redhat.com>
Mon, 27 Apr 2020 03:04:21 +0000 (11:04 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 3 Jun 2020 11:57:00 +0000 (19:57 +0800)
commit7d5053e800a39b00d666cee421beed1f801a454a
tree6a4a5200039e50ec9047949238e4cf41a0bb47d3
parentf76e108a306761171c84f2f5c8ef2b2702ebc056
qa/tasks: decode bytes returned by base64.b64encode()

we use the return value from `base64.b64encode()` as a string, this works
in python2, but in python3, instead of a string, `base64.b64encode()`
returns bytes. so for instance, if we try to compose command line
arguments using `pipes.quote()` by passing a byte instance, we will have
```
TypeError: cannot use a string pattern on a bytes-like object
```

in this change, the retval is always decoded using ASCII, because base64
only returns ASCII strings when encoding.

this change is not cherry-picked from master, as the changed files do
not exist in master anymore.

Signed-off-by: Kefu Chai <kchai@redhat.com>
qa/tasks/s3readwrite.py
qa/tasks/s3roundtrip.py
qa/tasks/swift.py