From ce252a9051bac2f1126e897579594e6ce58254d9 Mon Sep 17 00:00:00 2001 From: Paul Belanger Date: Fri, 1 Sep 2017 13:34:22 -0400 Subject: [PATCH] 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 --- roles/upload-afs/library/zuul_afs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/upload-afs/library/zuul_afs.py b/roles/upload-afs/library/zuul_afs.py index a4ac8edb1..d92fc21b0 100644 --- a/roles/upload-afs/library/zuul_afs.py +++ b/roles/upload-afs/library/zuul_afs.py @@ -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.