mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Only include diff in the state response if include_diff
is True
This commit is contained in:
parent
7803e7716c
commit
3841e1143b
1 changed files with 6 additions and 6 deletions
|
@ -166,18 +166,18 @@ def baseline_snapshot(name, number=None, tag=None, config='root', ignore=None):
|
|||
status.pop(target_file, None)
|
||||
|
||||
for file in status:
|
||||
status[file]['actions'] = status[file].pop("status")
|
||||
|
||||
# Only include diff for modified files
|
||||
if "modified" in status[file]['actions']:
|
||||
if "modified" in status[file]["status"] and include_diff:
|
||||
status[file].pop("status")
|
||||
status[file].update(__salt__['snapper.diff'](config,
|
||||
num_pre=0,
|
||||
num_post=number,
|
||||
filename=file)[file])
|
||||
filename=file).get(file, {}))
|
||||
|
||||
|
||||
if __opts__['test'] and status:
|
||||
ret['pchanges'] = ret["changes"]
|
||||
ret['changes'] = {}
|
||||
ret['pchanges'] = status
|
||||
ret['changes'] = ret['pchanges']
|
||||
ret['comment'] = "{0} files changes are set to be undone".format(len(status.keys()))
|
||||
ret['result'] = None
|
||||
elif __opts__['test'] and not status:
|
||||
|
|
Loading…
Add table
Reference in a new issue