fix OSError caused by symlink removing
authorGui Chen <gui.chen@intel.com>
Thu, 16 May 2013 06:46:03 +0000 (02:46 -0400)
committerGui Chen <gui.chen@intel.com>
Thu, 16 May 2013 06:46:03 +0000 (02:46 -0400)
Signed-off-by: Gui Chen <gui.chen@intel.com>
mic/utils/fs_related.py

index ae8799d..8b00107 100644 (file)
@@ -154,9 +154,8 @@ class BindChrootMount:
         self.mounted = True
         if os.path.islink(self.orig_src):
             dest = os.path.join(self.root, self.orig_src.lstrip('/'))
-            if os.path.exists(dest):
-                os.unlink(dest)
-            os.symlink(self.src, dest)
+            if not os.path.exists(dest):
+                os.symlink(self.src, dest)
 
     def unmount(self):
         if self.has_chroot_instance():