Accepting request 1161659 from home:mczernek:branches:systemsmanagement:saltstack
- Convert oscap output to UTF-8 - Added: * switch-oscap-encoding-to-utf-8-639.patch - Make Salt compatible with Python 3.11 - Added: * fix-salt-warnings-and-testuite-for-python-3.11-635.patch OBS-URL: https://build.opensuse.org/request/show/1161659 OBS-URL: https://build.opensuse.org/package/show/systemsmanagement:saltstack/salt?expand=0&rev=240
This commit is contained in:
parent
63fecc779b
commit
95f4841c4a
@ -1 +1 @@
|
||||
e5cb245008cb6c5c2e6da334bc30ceaa7c428bdf
|
||||
6f191fc01de41fe2c1c4b659d5738e80aeb89b4c
|
3860
fix-salt-warnings-and-testuite-for-python-3.11-635.patch
Normal file
3860
fix-salt-warnings-and-testuite-for-python-3.11-635.patch
Normal file
File diff suppressed because it is too large
Load Diff
16
salt.changes
16
salt.changes
@ -1,3 +1,19 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue Mar 26 08:44:29 UTC 2024 - Marek Czernek <marek.czernek@suse.com>
|
||||
|
||||
- Convert oscap output to UTF-8
|
||||
|
||||
- Added:
|
||||
* switch-oscap-encoding-to-utf-8-639.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Mar 21 13:14:03 UTC 2024 - Marek Czernek <marek.czernek@suse.com>
|
||||
|
||||
- Make Salt compatible with Python 3.11
|
||||
|
||||
- Added:
|
||||
* fix-salt-warnings-and-testuite-for-python-3.11-635.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Mar 15 10:00:35 UTC 2024 - Yeray Gutiérrez Cedrés <yeray.gutierrez@suse.com>
|
||||
|
||||
|
15
salt.spec
15
salt.spec
@ -357,8 +357,19 @@ Patch101: fix-problematic-tests-and-allow-smooth-tests-executi.patch
|
||||
Patch102: make-importing-seco.range-thread-safe-bsc-1211649.patch
|
||||
# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/66130
|
||||
PAtch103: fix-tests-failures-and-errors-when-detected-on-vm-ex.patch
|
||||
# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/66234
|
||||
Patch104: decode-oscap-byte-stream-to-string-bsc-1219001.patch
|
||||
# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/66234 (modified at Patch106)
|
||||
Patch104: decode-oscap-byte-stream-to-string-bsc-1219001.patch
|
||||
### Commits to make Salt compatible with Python 3.11 (and 3.6)
|
||||
# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/commit/d92b5423464f93da6e3feb47d05a9acef8da75f9
|
||||
# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/commit/60b36489225f958772b6a2f99d8fe6ae33ee9d73
|
||||
# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/commit/eee0eca5e48922e5e404f812ced08ca7484bb568
|
||||
# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/commit/991f7cf0a7baf08a31194ce52f4ec08290db8e52
|
||||
# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/commit/2688c86f45eea9f8a6b916fcdf8eb94b3f5e185b
|
||||
# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/commit/a1873a1d6d50d1769ddef528d7442e38aba9de23
|
||||
# PATCH-FIX_OPENSUSE https://github.com/openSUSE/salt/commit/c7ecccb0a080ca9cca097f760ef0992ab34f82df
|
||||
Patch105: fix-salt-warnings-and-testuite-for-python-3.11-635.patch
|
||||
# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/639
|
||||
Patch106: switch-oscap-encoding-to-utf-8-639.patch
|
||||
|
||||
### IMPORTANT: The line below is used as a snippet marker. Do not touch it.
|
||||
### SALT PATCHES LIST END
|
||||
|
80
switch-oscap-encoding-to-utf-8-639.patch
Normal file
80
switch-oscap-encoding-to-utf-8-639.patch
Normal file
@ -0,0 +1,80 @@
|
||||
From 4ec5c8bdb8aecac6752c639f494b86c7f8f57ba2 Mon Sep 17 00:00:00 2001
|
||||
From: Marek Czernek <marek.czernek@suse.com>
|
||||
Date: Tue, 26 Mar 2024 09:20:30 +0100
|
||||
Subject: [PATCH] Switch oscap encoding to utf-8 (#639)
|
||||
|
||||
---
|
||||
salt/modules/openscap.py | 7 ++++---
|
||||
tests/unit/modules/test_openscap.py | 8 ++++----
|
||||
2 files changed, 8 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/salt/modules/openscap.py b/salt/modules/openscap.py
|
||||
index 89712ae722b..7322c667dcc 100644
|
||||
--- a/salt/modules/openscap.py
|
||||
+++ b/salt/modules/openscap.py
|
||||
@@ -153,7 +153,7 @@ def xccdf_eval(xccdffile, ovalfiles=None, **kwargs):
|
||||
tempdir = tempfile.mkdtemp()
|
||||
proc = Popen(cmd_opts, stdout=PIPE, stderr=PIPE, cwd=tempdir)
|
||||
(_, error) = proc.communicate()
|
||||
- error = error.decode('ascii', errors='ignore')
|
||||
+ error = error.decode('utf-8', errors='surogateescape')
|
||||
success = _OSCAP_EXIT_CODES_MAP.get(proc.returncode, False)
|
||||
if proc.returncode < 0:
|
||||
error += "\nKilled by signal {}\n".format(proc.returncode)
|
||||
@@ -204,10 +204,11 @@ def xccdf(params):
|
||||
cmd = _XCCDF_MAP[action]["cmd_pattern"].format(args.profile, policy)
|
||||
tempdir = tempfile.mkdtemp()
|
||||
proc = Popen(shlex.split(cmd), stdout=PIPE, stderr=PIPE, cwd=tempdir)
|
||||
- (stdoutdata, error) = proc.communicate()
|
||||
+ (_, error) = proc.communicate()
|
||||
+ error = error.decode('utf-8', errors='surogateescape')
|
||||
success = _OSCAP_EXIT_CODES_MAP.get(proc.returncode, False)
|
||||
if proc.returncode < 0:
|
||||
- error += "\nKilled by signal {}\n".format(proc.returncode).encode('ascii')
|
||||
+ error += "\nKilled by signal {}\n".format(proc.returncode)
|
||||
returncode = proc.returncode
|
||||
if success:
|
||||
__salt__["cp.push_dir"](tempdir)
|
||||
diff --git a/tests/unit/modules/test_openscap.py b/tests/unit/modules/test_openscap.py
|
||||
index 6fbdfed7cf9..c20220ea977 100644
|
||||
--- a/tests/unit/modules/test_openscap.py
|
||||
+++ b/tests/unit/modules/test_openscap.py
|
||||
@@ -35,7 +35,7 @@ class OpenscapTestCase(TestCase):
|
||||
"salt.modules.openscap.Popen",
|
||||
MagicMock(
|
||||
return_value=Mock(
|
||||
- **{"returncode": 0, "communicate.return_value": ("", "")}
|
||||
+ **{"returncode": 0, "communicate.return_value": (bytes(0), bytes(0))}
|
||||
)
|
||||
),
|
||||
):
|
||||
@@ -82,7 +82,7 @@ class OpenscapTestCase(TestCase):
|
||||
"salt.modules.openscap.Popen",
|
||||
MagicMock(
|
||||
return_value=Mock(
|
||||
- **{"returncode": 2, "communicate.return_value": ("", "some error")}
|
||||
+ **{"returncode": 2, "communicate.return_value": (bytes(0), bytes("some error", "UTF-8"))}
|
||||
)
|
||||
),
|
||||
):
|
||||
@@ -137,7 +137,7 @@ class OpenscapTestCase(TestCase):
|
||||
"salt.modules.openscap.Popen",
|
||||
MagicMock(
|
||||
return_value=Mock(
|
||||
- **{"returncode": 2, "communicate.return_value": ("", "some error")}
|
||||
+ **{"returncode": 2, "communicate.return_value": (bytes(0), bytes("some error", "UTF-8"))}
|
||||
)
|
||||
),
|
||||
):
|
||||
@@ -180,7 +180,7 @@ class OpenscapTestCase(TestCase):
|
||||
return_value=Mock(
|
||||
**{
|
||||
"returncode": 1,
|
||||
- "communicate.return_value": ("", "evaluation error"),
|
||||
+ "communicate.return_value": (bytes(0), bytes("evaluation error", "UTF-8")),
|
||||
}
|
||||
)
|
||||
),
|
||||
--
|
||||
2.44.0
|
||||
|
Loading…
Reference in New Issue
Block a user