From fb9c485418e59cfead3ab28d8ff8cfb7a19bba48 Mon Sep 17 00:00:00 2001
From: Vratislav Podzimek <vpodzime@redhat.com>
Date: Tue, 23 Aug 2016 22:19:18 +0200
Subject: [PATCH 3/3] Don't require blank stderr when running the oscap tool
It may report some warnings and complete successfully. It should be safe for us
to rely on the exit code.
Resolves: rhbz#1355756
Signed-off-by: Vratislav Podzimek <vpodzime@redhat.com>
---
org_fedora_oscap/common.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/org_fedora_oscap/common.py b/org_fedora_oscap/common.py
index 6f95b2d..1b3eaa5 100644
--- a/org_fedora_oscap/common.py
+++ b/org_fedora_oscap/common.py
@@ -147,7 +147,7 @@ def _run_oscap_gen_fix(profile, fpath, template, ds_id="", xccdf_id="",
# pylint thinks Popen has no attribute returncode
# pylint: disable-msg=E1101
- if proc.returncode != 0 or stderr:
+ if proc.returncode != 0:
msg = "Failed to generate fix rules with the oscap tool: %s" % stderr
raise OSCAPaddonError(msg)
@@ -224,7 +224,7 @@ def run_oscap_remediate(profile, fpath, ds_id="", xccdf_id="", tailoring="",
# save stdout?
# pylint thinks Popen has no attribute returncode
# pylint: disable-msg=E1101
- if proc.returncode not in (0, 2) or stderr:
+ if proc.returncode not in (0, 2):
# 0 -- success; 2 -- no error, but checks/remediation failed
msg = "Content evaluation and remediation with the oscap tool "\
"failed: %s" % stderr
--
2.7.4