Open tarball in binary mode

Under python3 this open call fails in swiftclient because it tries to
decode the data using utf-8. Since we're uploading a binary tarball
anyway we should us binary i/o instead.

Change-Id: I5b8aff53e44024e916b9a491e52ffd9362ca39e4
Closes-Bug: #1788288
This commit is contained in:
Alex Schultz 2018-08-21 16:16:57 -06:00
parent 9f8de34eeb
commit 714145c563
1 changed files with 1 additions and 1 deletions

View File

@ -35,7 +35,7 @@ def create_tarball(directory, filename, options='-czf',
def tarball_extract_to_swift_container(object_client, filename, container):
LOG.debug('Uploading filename %s to Swift container %s' % (filename,
container))
with open(filename, 'r') as f:
with open(filename, 'rb') as f:
object_client.put_object(
container=container,
obj='',