use decode for py3 bytes/strings

Fixes: https://pagure.io/koji/issue/2976
This commit is contained in:
Tomas Kopecek 2021-08-06 12:35:52 +02:00
parent 0cfb2c0280
commit 06528a5650

View file

@ -1,4 +1,4 @@
#!/usr/bin/python2 #!/usr/bin/python3
# Koji daemon that runs in a Windows VM and executes commands associated # Koji daemon that runs in a Windows VM and executes commands associated
# with a task. # with a task.
@ -32,6 +32,7 @@ import hashlib
import logging import logging
import os import os
import re import re
import six # needed for imported code
import subprocess import subprocess
import sys import sys
import tempfile import tempfile
@ -607,7 +608,7 @@ def upload_file(server, prefix, path):
data = fobj.read(131072) data = fobj.read(131072)
if not data: if not data:
break break
encoded = base64.b64encode(data) encoded = base64.b64encode(data).decode()
server.upload(path, encode_int(offset), encoded) server.upload(path, encode_int(offset), encoded)
offset += len(data) offset += len(data)
sum.update(data) sum.update(data)
@ -700,7 +701,7 @@ def stream_logs(server, handler, builds):
contents = fd.read(65536) contents = fd.read(65536)
if contents: if contents:
size = len(contents) size = len(contents)
data = base64.b64encode(contents) data = base64.b64encode(contents).decode()
digest = hashlib.sha256(contents).hexdigest() digest = hashlib.sha256(contents).hexdigest()
del contents del contents
try: try: