1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

fix case in which file is created and backup is requested but fails, not it just doesn't attempt to backup the missing file

Signed-off-by: Brian Coca <briancoca+ansible@gmail.com>
This commit is contained in:
Brian Coca 2012-11-07 10:33:43 -05:00
parent 75d3b77454
commit 5ea260f44b

View file

@ -143,7 +143,7 @@ def present(module, dest, regexp, line, insertafter, create, backup):
changed = True
if changed:
if backup:
if backup and os.path.exists(dest):
module.backup_local(dest)
f = open(dest, 'wb')
f.writelines(lines)