diff --git a/files/file b/files/file index b1c57ff4d97..710a9224c13 100644 --- a/files/file +++ b/files/file @@ -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':