Don't barf if we can't unlink a non-existent file
authorSteve Muir <smuir@cs.princeton.edu>
Wed, 5 Oct 2005 22:15:51 +0000 (22:15 +0000)
committerSteve Muir <smuir@cs.princeton.edu>
Wed, 5 Oct 2005 22:15:51 +0000 (22:15 +0000)
python/vserver.py

index d77abba..c539ee9 100644 (file)
@@ -101,7 +101,11 @@ class VServer:
 
         # 'copy' original file, rename new to original
         backup = filename + ".old"
-        os.unlink(backup)
+        try:
+            os.unlink(backup)
+        except OSError, ex:
+            if ex.errno != errno.ENOENT:
+                raise
         os.link(filename, backup)
         os.rename(newfile, filename)