mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-25 16:06:43 +00:00
Only unlink the symlink tempfile on error if it was created in the
previous operation.
This commit is contained in:
@@ -305,7 +305,8 @@ def main():
|
||||
os.symlink(src, tmppath)
|
||||
os.rename(tmppath, path)
|
||||
except OSError, e:
|
||||
os.unlink(tmppath)
|
||||
if os.path.exists(tmppath):
|
||||
os.unlink(tmppath)
|
||||
module.fail_json(path=path, msg='Error while replacing: %s' % str(e))
|
||||
try:
|
||||
if state == 'hard':
|
||||
|
||||
Reference in New Issue
Block a user