Commit e157355f by Steve Smith

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

previous operation.
parent 2156e87e
......@@ -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':
......
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