diff --git a/changelog/65652.fixed.md b/changelog/65652.fixed.md new file mode 100644 index 000000000000..2f93147a2338 --- /dev/null +++ b/changelog/65652.fixed.md @@ -0,0 +1 @@ +Include changes in the results when schedule.present state is run with test=True. diff --git a/salt/states/schedule.py b/salt/states/schedule.py index 58937138378d..db02e90a82f5 100644 --- a/salt/states/schedule.py +++ b/salt/states/schedule.py @@ -264,6 +264,7 @@ def present(name, **kwargs): kwargs["test"] = True result = __salt__["schedule.add"](name, **kwargs) ret["comment"].append(result["comment"]) + ret["changes"] = {name: "added"} else: result = __salt__["schedule.add"](name, **kwargs) if not result["result"]: diff --git a/tests/pytests/unit/states/test_schedule.py b/tests/pytests/unit/states/test_schedule.py index 505bb3b5eb87..3d34979a0c22 100644 --- a/tests/pytests/unit/states/test_schedule.py +++ b/tests/pytests/unit/states/test_schedule.py @@ -220,7 +220,7 @@ def test_present(): ret = { "name": "job1", "result": True, - "changes": {}, + "changes": {"job1": "added"}, "comment": "Job: test-schedule would be added to schedule.", } with patch.dict(schedule.__opts__, {"test": True}):