osc copypac from project:systemsmanagement:saltstack:testing package:salt revision:430
OBS-URL: https://build.opensuse.org/package/show/systemsmanagement:saltstack/salt?expand=0&rev=195
This commit is contained in:
parent
6430be99be
commit
4f4ed53f86
@ -1 +1 @@
|
|||||||
4dd4ea97489b05983b3cd9277bca1edc25c50985
|
5f6617c92144fc48a0644695487050121351c5ba
|
34
drop-serial-from-event.unpack-in-cli.batch_async.patch
Normal file
34
drop-serial-from-event.unpack-in-cli.batch_async.patch
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
From f6ad8b59662333327b04aa8f6465f6f3bceaa152 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Alexander Graul <agraul@suse.com>
|
||||||
|
Date: Mon, 31 Jan 2022 10:24:26 +0100
|
||||||
|
Subject: [PATCH] Drop serial from event.unpack in cli.batch_async
|
||||||
|
|
||||||
|
---
|
||||||
|
salt/cli/batch_async.py | 3 +--
|
||||||
|
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/salt/cli/batch_async.py b/salt/cli/batch_async.py
|
||||||
|
index 09aa85258b..1012ce37cc 100644
|
||||||
|
--- a/salt/cli/batch_async.py
|
||||||
|
+++ b/salt/cli/batch_async.py
|
||||||
|
@@ -9,7 +9,6 @@ import logging
|
||||||
|
|
||||||
|
import salt.client
|
||||||
|
import salt.ext.tornado
|
||||||
|
-import tornado
|
||||||
|
from salt.cli.batch import batch_get_eauth, batch_get_opts, get_bnum
|
||||||
|
|
||||||
|
log = logging.getLogger(__name__)
|
||||||
|
@@ -109,7 +108,7 @@ class BatchAsync:
|
||||||
|
if not self.event:
|
||||||
|
return
|
||||||
|
try:
|
||||||
|
- mtag, data = self.event.unpack(raw, self.event.serial)
|
||||||
|
+ mtag, data = self.event.unpack(raw)
|
||||||
|
for (pattern, op) in self.patterns:
|
||||||
|
if mtag.startswith(pattern[:-1]):
|
||||||
|
minion = data["id"]
|
||||||
|
--
|
||||||
|
2.34.1
|
||||||
|
|
||||||
|
|
68
fix-inspector-module-export-function-bsc-1097531-481.patch
Normal file
68
fix-inspector-module-export-function-bsc-1097531-481.patch
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
From 554b13dec6a9770b7fbf287b3bf9af91a2cdabde Mon Sep 17 00:00:00 2001
|
||||||
|
From: Victor Zhestkov <vzhestkov@suse.com>
|
||||||
|
Date: Fri, 28 Jan 2022 16:44:25 +0300
|
||||||
|
Subject: [PATCH] Fix inspector module export function (bsc#1097531)
|
||||||
|
(#481)
|
||||||
|
|
||||||
|
---
|
||||||
|
salt/modules/inspectlib/fsdb.py | 8 ++++----
|
||||||
|
salt/modules/inspectlib/query.py | 2 +-
|
||||||
|
2 files changed, 5 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/salt/modules/inspectlib/fsdb.py b/salt/modules/inspectlib/fsdb.py
|
||||||
|
index 489fde5684..b834b8f678 100644
|
||||||
|
--- a/salt/modules/inspectlib/fsdb.py
|
||||||
|
+++ b/salt/modules/inspectlib/fsdb.py
|
||||||
|
@@ -137,7 +137,7 @@ class CsvDB:
|
||||||
|
return self._tables.keys()
|
||||||
|
|
||||||
|
def _load_table(self, table_name):
|
||||||
|
- with gzip.open(os.path.join(self.db_path, table_name), "rb") as table:
|
||||||
|
+ with gzip.open(os.path.join(self.db_path, table_name), "rt") as table:
|
||||||
|
return OrderedDict(
|
||||||
|
[tuple(elm.split(":")) for elm in next(csv.reader(table))]
|
||||||
|
)
|
||||||
|
@@ -184,7 +184,7 @@ class CsvDB:
|
||||||
|
"""
|
||||||
|
get_type = lambda item: str(type(item)).split("'")[1]
|
||||||
|
if not os.path.exists(os.path.join(self.db_path, obj._TABLE)):
|
||||||
|
- with gzip.open(os.path.join(self.db_path, obj._TABLE), "wb") as table_file:
|
||||||
|
+ with gzip.open(os.path.join(self.db_path, obj._TABLE), "wt") as table_file:
|
||||||
|
csv.writer(table_file).writerow(
|
||||||
|
[
|
||||||
|
"{col}:{type}".format(col=elm[0], type=get_type(elm[1]))
|
||||||
|
@@ -212,7 +212,7 @@ class CsvDB:
|
||||||
|
db_obj = self.get(obj.__class__, eq=fields)
|
||||||
|
if db_obj and distinct:
|
||||||
|
raise Exception("Object already in the database.")
|
||||||
|
- with gzip.open(os.path.join(self.db_path, obj._TABLE), "a") as table:
|
||||||
|
+ with gzip.open(os.path.join(self.db_path, obj._TABLE), "at") as table:
|
||||||
|
csv.writer(table).writerow(self._validate_object(obj))
|
||||||
|
|
||||||
|
def update(self, obj, matches=None, mt=None, lt=None, eq=None):
|
||||||
|
@@ -318,7 +318,7 @@ class CsvDB:
|
||||||
|
:return:
|
||||||
|
"""
|
||||||
|
objects = []
|
||||||
|
- with gzip.open(os.path.join(self.db_path, obj._TABLE), "rb") as table:
|
||||||
|
+ with gzip.open(os.path.join(self.db_path, obj._TABLE), "rt") as table:
|
||||||
|
header = None
|
||||||
|
for data in csv.reader(table):
|
||||||
|
if not header:
|
||||||
|
diff --git a/salt/modules/inspectlib/query.py b/salt/modules/inspectlib/query.py
|
||||||
|
index 079cc29172..8027176a13 100644
|
||||||
|
--- a/salt/modules/inspectlib/query.py
|
||||||
|
+++ b/salt/modules/inspectlib/query.py
|
||||||
|
@@ -74,7 +74,7 @@ class SysInfo:
|
||||||
|
for dev, dev_data in salt.utils.fsutils._blkid().items():
|
||||||
|
dev = self._get_disk_size(dev)
|
||||||
|
device = dev.pop("device")
|
||||||
|
- dev["type"] = dev_data["type"]
|
||||||
|
+ dev["type"] = dev_data.get("type", "UNKNOWN")
|
||||||
|
data[device] = dev
|
||||||
|
|
||||||
|
return data
|
||||||
|
--
|
||||||
|
2.34.1
|
||||||
|
|
||||||
|
|
18
salt.changes
18
salt.changes
@ -1,3 +1,21 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Jan 31 10:28:10 UTC 2022 - Alexander Graul <alexander.graul@suse.com>
|
||||||
|
|
||||||
|
- Fix exception in batch_async caused by a bad function call
|
||||||
|
|
||||||
|
- Added:
|
||||||
|
* drop-serial-from-event.unpack-in-cli.batch_async.patch
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri Jan 28 16:17:16 UTC 2022 - Victor Zhestkov <victor.zhestkov@suse.com>
|
||||||
|
|
||||||
|
- Fix inspector module export function (bsc#1097531)
|
||||||
|
- Wipe NOTIFY_SOCKET from env in cmdmod (bsc#1193357)
|
||||||
|
|
||||||
|
- Added:
|
||||||
|
* fix-inspector-module-export-function-bsc-1097531-481.patch
|
||||||
|
* wipe-notify_socket-from-env-in-cmdmod-bsc-1193357-30.patch
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Wed Jan 26 17:04:36 UTC 2022 - Alexander Graul <alexander.graul@suse.com>
|
Wed Jan 26 17:04:36 UTC 2022 - Alexander Graul <alexander.graul@suse.com>
|
||||||
|
|
||||||
|
@ -269,6 +269,12 @@ Patch64: fix-the-regression-for-yumnotify-plugin-456.patch
|
|||||||
Patch65: refactor-and-improvements-for-transactional-updates-.patch
|
Patch65: refactor-and-improvements-for-transactional-updates-.patch
|
||||||
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/61189
|
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/61189
|
||||||
Patch66: state.apply-don-t-check-for-cached-pillar-errors.patch
|
Patch66: state.apply-don-t-check-for-cached-pillar-errors.patch
|
||||||
|
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/61393
|
||||||
|
Patch67: wipe-notify_socket-from-env-in-cmdmod-bsc-1193357-30.patch
|
||||||
|
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/61530
|
||||||
|
Patch68: fix-inspector-module-export-function-bsc-1097531-481.patch
|
||||||
|
# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/482
|
||||||
|
Patch69: drop-serial-from-event.unpack-in-cli.batch_async.patch
|
||||||
|
|
||||||
|
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
|
84
wipe-notify_socket-from-env-in-cmdmod-bsc-1193357-30.patch
Normal file
84
wipe-notify_socket-from-env-in-cmdmod-bsc-1193357-30.patch
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
From 4da285c7b898645f8ffd0d0797df60ba107747e3 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Victor Zhestkov <vzhestkov@suse.com>
|
||||||
|
Date: Fri, 28 Jan 2022 16:40:09 +0300
|
||||||
|
Subject: [PATCH] Wipe NOTIFY_SOCKET from env in cmdmod (bsc#1193357) -
|
||||||
|
3004 (#473)
|
||||||
|
|
||||||
|
* Remove NOTIFY_SOCKET env variable from cmd.run calls
|
||||||
|
|
||||||
|
* Add test for NOTIFY_SOCKET env variable wiping
|
||||||
|
---
|
||||||
|
salt/modules/cmdmod.py | 3 ++
|
||||||
|
tests/pytests/unit/modules/test_cmdmod.py | 41 +++++++++++++++++++++++
|
||||||
|
2 files changed, 44 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/salt/modules/cmdmod.py b/salt/modules/cmdmod.py
|
||||||
|
index 70889da07c..61b328b13b 100644
|
||||||
|
--- a/salt/modules/cmdmod.py
|
||||||
|
+++ b/salt/modules/cmdmod.py
|
||||||
|
@@ -612,6 +612,9 @@ def _run(
|
||||||
|
if prepend_path:
|
||||||
|
run_env["PATH"] = ":".join((prepend_path, run_env["PATH"]))
|
||||||
|
|
||||||
|
+ if "NOTIFY_SOCKET" not in env:
|
||||||
|
+ run_env.pop("NOTIFY_SOCKET", None)
|
||||||
|
+
|
||||||
|
if python_shell is None:
|
||||||
|
python_shell = False
|
||||||
|
|
||||||
|
diff --git a/tests/pytests/unit/modules/test_cmdmod.py b/tests/pytests/unit/modules/test_cmdmod.py
|
||||||
|
index bc1d2818aa..691b89271e 100644
|
||||||
|
--- a/tests/pytests/unit/modules/test_cmdmod.py
|
||||||
|
+++ b/tests/pytests/unit/modules/test_cmdmod.py
|
||||||
|
@@ -368,6 +368,47 @@ def test_os_environment_remains_intact():
|
||||||
|
getpwnam_mock.assert_called_with("foobar")
|
||||||
|
|
||||||
|
|
||||||
|
+@pytest.mark.skip_on_windows
|
||||||
|
+def test_os_environment_do_not_pass_notify_socket():
|
||||||
|
+ """
|
||||||
|
+ Make sure NOTIFY_SOCKET environment variable is not passed
|
||||||
|
+ to the command if not explicitly set with env parameter.
|
||||||
|
+ """
|
||||||
|
+ with patch("pwd.getpwnam") as getpwnam_mock:
|
||||||
|
+ new_env = os.environ.copy()
|
||||||
|
+ new_env.update({"NOTIFY_SOCKET": "/run/systemd/notify"})
|
||||||
|
+ with patch("subprocess.Popen") as popen_mock, patch(
|
||||||
|
+ "os.environ.copy", return_value=new_env
|
||||||
|
+ ):
|
||||||
|
+ popen_mock.return_value = Mock(
|
||||||
|
+ communicate=lambda *args, **kwags: [b"", None],
|
||||||
|
+ pid=lambda: 1,
|
||||||
|
+ retcode=0,
|
||||||
|
+ )
|
||||||
|
+
|
||||||
|
+ with patch.dict(cmdmod.__grains__, {"os": "SUSE", "os_family": "Suse"}):
|
||||||
|
+ if sys.platform.startswith(("freebsd", "openbsd")):
|
||||||
|
+ shell = "/bin/sh"
|
||||||
|
+ else:
|
||||||
|
+ shell = "/bin/bash"
|
||||||
|
+
|
||||||
|
+ cmdmod._run("ls", cwd=tempfile.gettempdir(), shell=shell)
|
||||||
|
+
|
||||||
|
+ assert "NOTIFY_SOCKET" not in popen_mock.call_args_list[0][1]["env"]
|
||||||
|
+
|
||||||
|
+ cmdmod._run(
|
||||||
|
+ "ls",
|
||||||
|
+ cwd=tempfile.gettempdir(),
|
||||||
|
+ shell=shell,
|
||||||
|
+ env={"NOTIFY_SOCKET": "/run/systemd/notify.new"},
|
||||||
|
+ )
|
||||||
|
+
|
||||||
|
+ assert (
|
||||||
|
+ popen_mock.call_args_list[1][1]["env"]["NOTIFY_SOCKET"]
|
||||||
|
+ == "/run/systemd/notify.new"
|
||||||
|
+ )
|
||||||
|
+
|
||||||
|
+
|
||||||
|
@pytest.mark.skip_unless_on_darwin
|
||||||
|
def test_shell_properly_handled_on_macOS():
|
||||||
|
"""
|
||||||
|
--
|
||||||
|
2.34.1
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user