5af0dfb7fe
OBS-URL: https://build.opensuse.org/package/show/systemsmanagement:saltstack/salt?expand=0&rev=189
41 lines
1.6 KiB
Diff
41 lines
1.6 KiB
Diff
From b7d11d8caf3eb4fb39a070201be87bb1b3abd525 Mon Sep 17 00:00:00 2001
|
|
From: Vladimir Nadvornik <nadvornik@suse.cz>
|
|
Date: Wed, 11 Aug 2021 12:19:09 +0200
|
|
Subject: [PATCH] Fix error handling in openscap module (bsc#1188647)
|
|
(#409)
|
|
|
|
---
|
|
salt/modules/openscap.py | 8 ++++++--
|
|
1 file changed, 6 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/salt/modules/openscap.py b/salt/modules/openscap.py
|
|
index f75e1c5e6b..216fd89eef 100644
|
|
--- a/salt/modules/openscap.py
|
|
+++ b/salt/modules/openscap.py
|
|
@@ -153,7 +153,9 @@ def xccdf_eval(xccdffile, ovalfiles=None, **kwargs):
|
|
tempdir = tempfile.mkdtemp()
|
|
proc = Popen(cmd_opts, stdout=PIPE, stderr=PIPE, cwd=tempdir)
|
|
(stdoutdata, error) = proc.communicate()
|
|
- success = _OSCAP_EXIT_CODES_MAP[proc.returncode]
|
|
+ success = _OSCAP_EXIT_CODES_MAP.get(proc.returncode, False)
|
|
+ if proc.returncode < 0:
|
|
+ error += "\nKilled by signal {}\n".format(proc.returncode).encode('ascii')
|
|
returncode = proc.returncode
|
|
if success:
|
|
__salt__["cp.push_dir"](tempdir)
|
|
@@ -202,7 +204,9 @@ def xccdf(params):
|
|
tempdir = tempfile.mkdtemp()
|
|
proc = Popen(shlex.split(cmd), stdout=PIPE, stderr=PIPE, cwd=tempdir)
|
|
(stdoutdata, error) = proc.communicate()
|
|
- success = _OSCAP_EXIT_CODES_MAP[proc.returncode]
|
|
+ success = _OSCAP_EXIT_CODES_MAP.get(proc.returncode, False)
|
|
+ if proc.returncode < 0:
|
|
+ error += "\nKilled by signal {}\n".format(proc.returncode).encode('ascii')
|
|
returncode = proc.returncode
|
|
if success:
|
|
__salt__["cp.push_dir"](tempdir)
|
|
--
|
|
2.32.0
|
|
|
|
|