From 9b2801d9ea538ba0e5c611b597e454801cb52c15 Mon Sep 17 00:00:00 2001
From: Gabriel Becker <ggasparb@redhat.com>
Date: Mon, 27 Apr 2020 18:37:45 +0200
Subject: [PATCH] Fix SSGTS when running with python3 and writing binary data
to file.
---
tests/ssg_test_suite/oscap.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/tests/ssg_test_suite/oscap.py b/tests/ssg_test_suite/oscap.py
index 2858963373..2cbb18bc13 100644
--- a/tests/ssg_test_suite/oscap.py
+++ b/tests/ssg_test_suite/oscap.py
@@ -168,8 +168,8 @@ def run_stage_remediation_ansible(run_type, formatting, verbose_path):
command_string = ' '.join(command)
returncode, output = common.run_cmd_local(command, verbose_path)
# Appends output of ansible-playbook to the verbose_path file.
- with open(verbose_path, 'a') as f:
- f.write('Stdout of "{}":'.format(command_string))
+ with open(verbose_path, 'ab') as f:
+ f.write('Stdout of "{}":'.format(command_string).encode("utf-8"))
f.write(output.encode("utf-8"))
if returncode != 0:
msg = (
@@ -197,8 +197,8 @@ def run_stage_remediation_bash(run_type, formatting, verbose_path):
returncode, output = common.run_cmd_remote(
command_string, formatting['domain_ip'], verbose_path)
# Appends output of script execution to the verbose_path file.
- with open(verbose_path, 'a') as f:
- f.write('Stdout of "{}":'.format(command_string))
+ with open(verbose_path, 'ab') as f:
+ f.write('Stdout of "{}":'.format(command_string).encode("utf-8"))
f.write(output.encode("utf-8"))
if returncode != 0:
msg = (