Fix python3 encoding issues with zuul_afs

NamedTemporaryFile mode is mode='w+b' by default. Make sure we encode
utf8 and write bytes to our temp file.

Change-Id: I0b31abcd52c049efc7d95d6d6e39dfb5d0860620
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2017-09-01 13:34:22 -04:00
parent cc59ca16ab
commit ce252a9051
No known key found for this signature in database
GPG Key ID: 611A80832067AF38

View File

@ -66,7 +66,7 @@ def afs_sync(afssource, afstarget):
filter_file = tempfile.NamedTemporaryFile(delete=False)
for exclude in excludes:
filter_file.write('- %s\n' % exclude)
filter_file.write(b'- %s\n' % exclude.encode('utf8'))
filter_file.close()
# Perform the rsync with the filter list.