mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
Catch exceptions from rmtree
This commit is contained in:
1 parent
4518404706
commit
df8bdcc152
3 files changed
+38
-3
No files matched your search
@@ -195,7 +195,10 @@ class Project:
|
||||
for vm in self._vms:
|
||||
vm.close()
|
||||
if cleanup and os.path.exists(self.path):
|
||||
yield from wait_run_in_executor(shutil.rmtree, self.path)
|
||||
try:
|
||||
yield from wait_run_in_executor(shutil.rmtree, self.path)
|
||||
except OSError as e:
|
||||
raise aiohttp.web.HTTPInternalServerError(text="Could not delete the project directory: {}".format(e))
|
||||
|
||||
@asyncio.coroutine
|
||||
def commit(self):
|
||||
@@ -205,7 +208,10 @@ class Project:
|
||||
vm = self._vms_to_destroy.pop()
|
||||
directory = self.vm_working_directory(vm)
|
||||
if os.path.exists(directory):
|
||||
yield from wait_run_in_executor(shutil.rmtree, directory)
|
||||
try:
|
||||
yield from wait_run_in_executor(shutil.rmtree, directory)
|
||||
except OSError as e:
|
||||
raise aiohttp.web.HTTPInternalServerError(text="Could not delete the project directory: {}".format(e))
|
||||
self.remove_vm(vm)
|
||||
|
||||
@asyncio.coroutine
|
||||
|
||||
Reference in new issue
Block a user