mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fixed backup file behavior in check mode (#24899)
Fixes ansible/ansible#21523
This commit is contained in:
parent
a1709bf0f9
commit
ce584571e8
1 changed files with 2 additions and 3 deletions
|
@ -752,12 +752,11 @@ def main():
|
||||||
res_args['diff'] = diff
|
res_args['diff'] = diff
|
||||||
|
|
||||||
# retain the backup only if crontab or cron file have changed
|
# retain the backup only if crontab or cron file have changed
|
||||||
if backup:
|
if backup and not module.check_mode:
|
||||||
if changed:
|
if changed:
|
||||||
res_args['backup_file'] = backup_file
|
res_args['backup_file'] = backup_file
|
||||||
else:
|
else:
|
||||||
if not module.check_mode:
|
os.unlink(backup_file)
|
||||||
os.unlink(backup_file)
|
|
||||||
|
|
||||||
if cron_file:
|
if cron_file:
|
||||||
res_args['cron_file'] = cron_file
|
res_args['cron_file'] = cron_file
|
||||||
|
|
Loading…
Reference in a new issue