Don't fail create/clone if /var/lib/qubes/TYPE/NAME/ exists

This commit is contained in:
Rusty Bird 2018-01-21 22:28:47 +00:00
parent fe77b0ec85
commit 4ae854fdaf
No known key found for this signature in database
GPG Key ID: 469D78F47AAF2ADF
2 changed files with 3 additions and 3 deletions

View File

@ -93,7 +93,7 @@ class TC_00_DispVM(qubes.tests.QubesTestCase):
self.assertEqual(dispvm.label, self.appvm.label)
self.assertEqual(dispvm.auto_cleanup, True)
mock_makedirs.assert_called_once_with(
'/var/lib/qubes/appvms/' + dispvm.name, mode=0o775)
'/var/lib/qubes/appvms/' + dispvm.name, mode=0o775, exist_ok=True)
mock_symlink.assert_called_once_with(
'/usr/share/icons/hicolor/128x128/devices/appvm-red.png',
'/var/lib/qubes/appvms/{}/icon.png'.format(dispvm.name))

View File

@ -1351,7 +1351,7 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
'''
self.log.info('Creating directory: {0}'.format(self.dir_path))
os.makedirs(self.dir_path, mode=0o775)
os.makedirs(self.dir_path, mode=0o775, exist_ok=True)
if pool or pools:
# pylint: disable=attribute-defined-outside-init
@ -1418,7 +1418,7 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
assert not os.path.exists(self.dir_path), msg
self.log.info('Creating directory: {0}'.format(self.dir_path))
os.makedirs(self.dir_path, mode=0o775)
os.makedirs(self.dir_path, mode=0o775, exist_ok=True)
if pool or pools:
# pylint: disable=attribute-defined-outside-init