1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-15 12:59:06 +00:00

Fixes race condition when deleting empty legacy project files dir.

This commit is contained in:
Jeremy 2015-02-25 17:38:36 -07:00
parent 473eb0280e
commit 9dc713f31d

View File

@ -177,20 +177,14 @@ class BaseManager:
raise aiohttp.web.HTTPInternalServerError(text="Could not move VM working directory: {} to {} {}".format(vm_working_dir, new_vm_working_dir, e))
try:
if not os.listdir(module_path):
os.rmdir(module_path)
except OSError as e:
raise aiohttp.web.HTTPInternalServerError(text="Could not delete {}: {}".format(module_path, e))
except FileNotFoundError as e:
log.warning(e)
os.rmdir(module_path)
except OSError:
pass
try:
if not os.listdir(project_files_dir):
os.rmdir(project_files_dir)
except OSError as e:
raise aiohttp.web.HTTPInternalServerError(text="Could not delete {}: {}".format(project_files_dir, e))
except FileNotFoundError as e:
log.warning(e)
os.rmdir(project_files_dir)
except OSError:
pass
if not vm_id:
vm_id = str(uuid4())