SHA256
1
0
forked from pool/salt

osc copypac from project:systemsmanagement:saltstack:testing package:salt revision:432

OBS-URL: https://build.opensuse.org/package/show/systemsmanagement:saltstack/salt?expand=0&rev=196
This commit is contained in:
Pablo Suárez Hernández 2022-02-08 14:02:38 +00:00 committed by Git OBS Bridge
parent 4f4ed53f86
commit cfbaca9093
6 changed files with 138 additions and 3 deletions

View File

@ -1 +1 @@
5f6617c92144fc48a0644695487050121351c5ba
e2c4840e38a6c4ab52bdba40139d9fb461d9b754

View File

@ -0,0 +1,40 @@
From aec7965f19f55d3d33893833fd259606d3a7e641 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pablo=20Su=C3=A1rez=20Hern=C3=A1ndez?=
<psuarezhernandez@suse.com>
Date: Tue, 8 Feb 2022 11:53:47 +0000
Subject: [PATCH] Add missing "ansible" module functions to whitelist in
Salt 3004 (bsc#1195625) (#485)
* Add missing functions to ansible __load__
* Properly get separated copies from list
---
salt/modules/ansiblegate.py | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/salt/modules/ansiblegate.py b/salt/modules/ansiblegate.py
index f33be6a00e..7c3a17861a 100644
--- a/salt/modules/ansiblegate.py
+++ b/salt/modules/ansiblegate.py
@@ -45,7 +45,16 @@ hosts:
"""
DEFAULT_TIMEOUT = 1200 # seconds (20 minutes)
-__load__ = __non_ansible_functions__ = ["help", "list_", "call", "playbooks"][:]
+__non_ansible_functions__ = []
+
+__load__ = __non_ansible_functions__[:] = [
+ "help",
+ "list_",
+ "call",
+ "playbooks",
+ "discover_playbooks",
+ "targets",
+]
def _set_callables(modules):
--
2.35.1

View File

@ -0,0 +1,70 @@
From 245bd5f2aab798f7f647ad2d2307c0dd1381c1c8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=A9dric=20Bosdonnat?= <cbosdonnat@suse.com>
Date: Thu, 18 Nov 2021 14:46:25 +0100
Subject: [PATCH] Fix salt-call event.send call with grains and pillar
---
changelog/61252.fixed | 1 +
salt/modules/event.py | 4 ++--
tests/pytests/integration/modules/test_event.py | 12 +++++++++++-
3 files changed, 14 insertions(+), 3 deletions(-)
create mode 100644 changelog/61252.fixed
diff --git a/changelog/61252.fixed b/changelog/61252.fixed
new file mode 100644
index 0000000000..2692f9b7b7
--- /dev/null
+++ b/changelog/61252.fixed
@@ -0,0 +1 @@
+Fix salt-call event.event with pillar or grains
diff --git a/salt/modules/event.py b/salt/modules/event.py
index 03dad5e614..7fe701708b 100644
--- a/salt/modules/event.py
+++ b/salt/modules/event.py
@@ -216,13 +216,13 @@ def send(
if isinstance(with_grains, list):
data_dict["grains"] = _dict_subset(with_grains, __grains__)
else:
- data_dict["grains"] = __grains__
+ data_dict["grains"] = __grains__.value()
if with_pillar:
if isinstance(with_pillar, list):
data_dict["pillar"] = _dict_subset(with_pillar, __pillar__)
else:
- data_dict["pillar"] = __pillar__
+ data_dict["pillar"] = __pillar__.value()
if with_env_opts:
data_dict["saltenv"] = __opts__.get("saltenv", "base")
diff --git a/tests/pytests/integration/modules/test_event.py b/tests/pytests/integration/modules/test_event.py
index 54087b1b65..8912c1e807 100644
--- a/tests/pytests/integration/modules/test_event.py
+++ b/tests/pytests/integration/modules/test_event.py
@@ -68,7 +68,14 @@ def test_send(event_listener, salt_master, salt_minion, salt_call_cli):
event_tag = random_string("salt/test/event/")
data = {"event.fire": "just test it!!!!"}
start_time = time.time()
- ret = salt_call_cli.run("event.send", event_tag, data=data)
+ ret = salt_call_cli.run(
+ "event.send",
+ event_tag,
+ data=data,
+ with_grains=True,
+ with_pillar=True,
+ preload={"foo": "bar"},
+ )
assert ret.exitcode == 0
assert ret.json
assert ret.json is True
@@ -82,3 +89,6 @@ def test_send(event_listener, salt_master, salt_minion, salt_call_cli):
assert event.data["id"] == salt_minion.id
assert event.data["cmd"] == "_minion_event"
assert "event.fire" in event.data["data"]
+ assert event.data["foo"] == "bar"
+ assert event.data["data"]["grains"]["test_grain"] == "cheese"
+ assert event.data["data"]["pillar"]["ext_spam"] == "eggs"
--
2.34.1

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7480c92d4197b02504c9a130a0268fd028eb0fd45d3c7a7075b8b78da85050ed
size 9943287
oid sha256:2b1610ccab5866f29f7d1934f315006954ba60a31bbc3c60c07b44a5ea018a06
size 10429711

View File

@ -1,3 +1,24 @@
-------------------------------------------------------------------
Tue Feb 8 13:53:36 UTC 2022 - Pablo Suárez Hernández <pablo.suarezhernandez@suse.com>
- Update generated documentation to 3004
-------------------------------------------------------------------
Tue Feb 8 12:02:04 UTC 2022 - Pablo Suárez Hernández <pablo.suarezhernandez@suse.com>
- Expose missing "ansible" module functions in Salt 3004 (bsc#1195625)
- Added:
* add-missing-ansible-module-functions-to-whitelist-in.patch
-------------------------------------------------------------------
Mon Feb 7 10:33:28 UTC 2022 - Alexander Graul <alexander.graul@suse.com>
- Fix salt-call event.send with pillar or grains
- Added:
* fix-salt-call-event.send-call-with-grains-and-pillar.patch
-------------------------------------------------------------------
Mon Jan 31 10:28:10 UTC 2022 - Alexander Graul <alexander.graul@suse.com>

View File

@ -275,6 +275,10 @@ Patch67: wipe-notify_socket-from-env-in-cmdmod-bsc-1193357-30.patch
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
# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/485
Patch70: add-missing-ansible-module-functions-to-whitelist-in.patch
# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/61256
Patch71: fix-salt-call-event.send-call-with-grains-and-pillar.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build