summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xlorry-controller-minion12
1 files changed, 7 insertions, 5 deletions
diff --git a/lorry-controller-minion b/lorry-controller-minion
index 6e2affd..0412629 100755
--- a/lorry-controller-minion
+++ b/lorry-controller-minion
@@ -126,7 +126,7 @@ class MINION(cliapp.Application):
logging.error(str(e))
return None
- obj = json.loads(body)
+ obj = json.loads(body.decode('utf-8'))
if obj.get('job_id', None):
return obj
return None
@@ -203,7 +203,8 @@ class MINION(cliapp.Application):
r, w, x = select.select([self.stdout_fd], [], [], wait_for_output)
stdout = stderr = ''
if r:
- stdout = os.read(self.stdout_fd, read_size)
+ stdout = os.read(self.stdout_fd, read_size) \
+ .decode('utf-8', errors='replace')
else:
# Finished.
if exit != 0:
@@ -213,7 +214,7 @@ class MINION(cliapp.Application):
data = os.read(self.stdout_fd, read_size)
if not data:
break
- stdout_parts.append(data)
+ stdout_parts.append(data.decode('utf-8', errors='replace'))
stdout = ''.join(stdout_parts)
stderr = ''
os.remove(self.temp_lorry_filename)
@@ -251,7 +252,7 @@ class MINION(cliapp.Application):
logging.error(str(e))
return
- obj = json.loads(body)
+ obj = json.loads(body.decode('utf-8'))
return obj['kill']
def webapp_request(self, method, path, body):
@@ -275,7 +276,8 @@ class MINION(cliapp.Application):
conn.close()
if response.status != http.client.OK:
- raise WEBAPPError(response.status, response.reason, response_body)
+ raise WEBAPPError(response.status, response.reason,
+ response_body.decode('utf-8', errors='replace'))
return response_body