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

previous operation.
reviewable/pr18780/r1
Steve Smith 11 years ago
parent 5e557c6d29
commit 5b5af14921

@ -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:

Loading…
Cancel
Save