Blob Blame History Raw
From 323926afbf4d1337e1bcdfc07e7d8e64f6289bf1 Mon Sep 17 00:00:00 2001
From: Patrick Uiterwijk <patrick@puiterwijk.org>
Date: Dec 07 2017 01:55:04 +0000
Subject: Fix encoding issue in runroot with python3


This will make sure that the log from the server is correctly decoded, since
sys.stdout only accepts strings, not raw bytes, which is what downloadTaskOutput
returns.

Signed-off-by: Patrick Uiterwijk <patrick@puiterwijk.org>

---

diff --git a/plugins/cli/runroot.py b/plugins/cli/runroot.py
index f8d4b50..dc5d737 100644
--- a/plugins/cli/runroot.py
+++ b/plugins/cli/runroot.py
@@ -90,7 +90,7 @@ def handle_runroot(options, session, args):
     if 'runroot.log' in output:
         for volume in output['runroot.log']:
             log = session.downloadTaskOutput(task_id, 'runroot.log', volume=volume)
-            sys.stdout.write(log)
+            sys.stdout.write(log.decode('utf8'))
     info = session.getTaskInfo(task_id)
     if info is None:
         sys.exit(1)