mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Ensure that the correct value of jid_inclue is passed if the argument is included in the passed keyword arguments
This commit is contained in:
parent
872293bbb0
commit
727c3fe784
2 changed files with 33 additions and 2 deletions
|
@ -521,8 +521,7 @@ def build_schedule_item(name, **kwargs):
|
|||
else:
|
||||
schedule[name]["enabled"] = True
|
||||
|
||||
if "jid_include" not in kwargs or kwargs["jid_include"]:
|
||||
schedule[name]["jid_include"] = True
|
||||
schedule[name]["jid_include"] = kwargs.get("jid_include", True)
|
||||
|
||||
if "splay" in kwargs:
|
||||
if isinstance(kwargs["splay"], dict):
|
||||
|
|
|
@ -198,6 +198,38 @@ def test_build_schedule_item_invalid_jobs_args():
|
|||
) == {"comment": comment2, "result": False}
|
||||
|
||||
|
||||
def test_build_schedule_item_jid_include():
|
||||
"""
|
||||
Test build_schedule_item when jid_include is passed and not passed
|
||||
"""
|
||||
ret = schedule.build_schedule_item("job1", function="test.args", jid_include=False)
|
||||
assert ret == {
|
||||
"function": "test.args",
|
||||
"maxrunning": 1,
|
||||
"name": "job1",
|
||||
"enabled": True,
|
||||
"jid_include": False,
|
||||
}
|
||||
|
||||
ret = schedule.build_schedule_item("job1", function="test.args", jid_include=True)
|
||||
assert ret == {
|
||||
"function": "test.args",
|
||||
"maxrunning": 1,
|
||||
"name": "job1",
|
||||
"enabled": True,
|
||||
"jid_include": True,
|
||||
}
|
||||
|
||||
ret = schedule.build_schedule_item("job1", function="test.args")
|
||||
assert ret == {
|
||||
"function": "test.args",
|
||||
"maxrunning": 1,
|
||||
"name": "job1",
|
||||
"enabled": True,
|
||||
"jid_include": True,
|
||||
}
|
||||
|
||||
|
||||
# 'add' function tests: 1
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue