Don't fail create/clone if /var/lib/qubes/TYPE/NAME/ exists
This commit is contained in:
		
							parent
							
								
									fe77b0ec85
								
							
						
					
					
						commit
						4ae854fdaf
					
				@ -93,7 +93,7 @@ class TC_00_DispVM(qubes.tests.QubesTestCase):
 | 
				
			|||||||
        self.assertEqual(dispvm.label, self.appvm.label)
 | 
					        self.assertEqual(dispvm.label, self.appvm.label)
 | 
				
			||||||
        self.assertEqual(dispvm.auto_cleanup, True)
 | 
					        self.assertEqual(dispvm.auto_cleanup, True)
 | 
				
			||||||
        mock_makedirs.assert_called_once_with(
 | 
					        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(
 | 
					        mock_symlink.assert_called_once_with(
 | 
				
			||||||
            '/usr/share/icons/hicolor/128x128/devices/appvm-red.png',
 | 
					            '/usr/share/icons/hicolor/128x128/devices/appvm-red.png',
 | 
				
			||||||
            '/var/lib/qubes/appvms/{}/icon.png'.format(dispvm.name))
 | 
					            '/var/lib/qubes/appvms/{}/icon.png'.format(dispvm.name))
 | 
				
			||||||
 | 
				
			|||||||
@ -1351,7 +1351,7 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
 | 
				
			|||||||
        '''
 | 
					        '''
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.log.info('Creating directory: {0}'.format(self.dir_path))
 | 
					        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:
 | 
					        if pool or pools:
 | 
				
			||||||
            # pylint: disable=attribute-defined-outside-init
 | 
					            # 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
 | 
					        assert not os.path.exists(self.dir_path), msg
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.log.info('Creating directory: {0}'.format(self.dir_path))
 | 
					        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:
 | 
					        if pool or pools:
 | 
				
			||||||
            # pylint: disable=attribute-defined-outside-init
 | 
					            # pylint: disable=attribute-defined-outside-init
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user