Handle LAVA xmlrpc Binary data

Some xmlrpc calls to LAVA will return binary data, in that case,
decode it to utf8 before trying to write to a file.

Change-Id: I548d5dbafce2b51a91f68f8969c2b06910bf0a34
Signed-off-by: Dean Birch <dean.birch@arm.com>
diff --git a/tfm_ci_pylib/lava_rpc_connector.py b/tfm_ci_pylib/lava_rpc_connector.py
index 6bd1493..5db23b1 100644
--- a/tfm_ci_pylib/lava_rpc_connector.py
+++ b/tfm_ci_pylib/lava_rpc_connector.py
@@ -84,7 +84,7 @@
         return job_def, def_o.get('metadata', [])
 
     def write_target_lines(self, target_out_file, log):
-        log = yaml.load(str(log))
+        log = yaml.load(log)
         with open(target_out_file, "w+") as F:
             for line in log:
                 if line['lvl'] in ['target', 'feedback']:
@@ -92,9 +92,10 @@
 
     def get_job_log(self, job_id, yaml_out_file=None, target_out_file=None):
         job_res, job_log = self.scheduler.jobs.logs(job_id)
+        job_log = job_log.data.decode('utf-8')
         if yaml_out_file:
             with open(yaml_out_file, "w") as F:
-                F.write(str(job_log))
+                F.write(job_log)
         if target_out_file:
             self.write_target_lines(target_out_file, job_log)
         return job_log
@@ -105,7 +106,8 @@
             with open(yaml_out_file, "w") as F:
                 for data in job_config:
                     if data:
-                        F.write(str(data))
+                        line = data.data.decode('utf-8')
+                        F.write(line)
         return job_config
 
     def get_job_info(self, job_id, yaml_out_file=None):