Browse Source

qubesvm: don't crash VM creation if icon symlink already exists

It can be leftover from previous failed attempt. Don't crash on it, and
replace it instead.

QubesOS/qubes-issues#3438
Marek Marczykowski-Górecki 5 years ago
parent
commit
ba210c41ee
1 changed files with 2 additions and 0 deletions
  1. 2 0
      qubes/vm/qubesvm.py

+ 2 - 0
qubes/vm/qubesvm.py

@@ -1439,6 +1439,8 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
                                    'creation'.format(self.dir_path))
             raise
 
+        if os.path.exists(self.icon_path):
+            os.unlink(self.icon_path)
         self.log.info('Creating icon symlink: {} -> {}'.format(
             self.icon_path, self.label.icon_path))
         if hasattr(os, "symlink"):