Commit e157355f by Steve Smith

Only unlink the symlink tempfile on error if it was created in the

previous operation.
parent 2156e87e
...@@ -305,6 +305,7 @@ def main(): ...@@ -305,6 +305,7 @@ def main():
os.symlink(src, tmppath) os.symlink(src, tmppath)
os.rename(tmppath, path) os.rename(tmppath, path)
except OSError, e: except OSError, e:
if os.path.exists(tmppath):
os.unlink(tmppath) os.unlink(tmppath)
module.fail_json(path=path, msg='Error while replacing: %s' % str(e)) module.fail_json(path=path, msg='Error while replacing: %s' % str(e))
try: try:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment