mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
fixes saltstack/salt#64150 cmd.run doesn't output changes in test mode
This commit is contained in:
parent
99cb7c0e08
commit
98ecf8d45c
3 changed files with 5 additions and 1 deletions
1
changelog/64150.fixed.md
Normal file
1
changelog/64150.fixed.md
Normal file
|
@ -0,0 +1 @@
|
|||
Fix cmd.run doesn't output changes in test mode
|
|
@ -849,6 +849,7 @@ def run(
|
|||
if __opts__["test"] and not test_name:
|
||||
ret["result"] = None
|
||||
ret["comment"] = 'Command "{}" would have been executed'.format(name)
|
||||
ret["changes"] = {"cmd": name}
|
||||
return _reinterpreted_state(ret) if stateful else ret
|
||||
|
||||
if cwd and not os.path.isdir(cwd):
|
||||
|
|
|
@ -77,7 +77,9 @@ def test_run():
|
|||
|
||||
with patch.dict(cmd.__opts__, {"test": True}):
|
||||
comt = 'Command "cmd.script" would have been executed'
|
||||
ret.update({"comment": comt, "result": None, "changes": {}})
|
||||
ret.update(
|
||||
{"comment": comt, "result": None, "changes": {"cmd": "cmd.script"}}
|
||||
)
|
||||
assert cmd.run(name) == ret
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue