Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP1:Update
salt.25404
fix-salt-call-event.send-call-with-grains-and-p...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File fix-salt-call-event.send-call-with-grains-and-pillar.patch of Package salt.25404
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
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor