From b0b494fff025ae35a5881297075475684adafee5 Mon Sep 17 00:00:00 2001 From: Haibo Lin Date: Fri, 15 Jul 2022 13:17:46 +0800 Subject: [PATCH] Convert _ssh_run output to str for python3 This is for fixing "a bytes-like object is required, not 'str'" issue in runroot task. JIRA: RHELCMP-9224 Signed-off-by: Haibo Lin --- pungi/runroot.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pungi/runroot.py b/pungi/runroot.py index 95912e90..eb7e2dc4 100644 --- a/pungi/runroot.py +++ b/pungi/runroot.py @@ -15,6 +15,7 @@ import os import re +import six from six.moves import shlex_quote import kobo.log from kobo.shortcuts import run @@ -149,7 +150,11 @@ class Runroot(kobo.log.LoggingBase): """ formatted_cmd = command.format(**fmt_dict) if fmt_dict else command ssh_cmd = ["ssh", "-oBatchMode=yes", "-n", "-l", user, hostname, formatted_cmd] - return run(ssh_cmd, show_cmd=True, logfile=log_file)[1] + output = run(ssh_cmd, show_cmd=True, logfile=log_file)[1] + if six.PY3 and isinstance(output, bytes): + return output.decode() + else: + return output def _log_file(self, base, suffix): return base.replace(".log", "." + suffix + ".log")