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)) raise aiohttp.web.HTTPInternalServerError(text="Could not move VM working directory: {} to {} {}".format(vm_working_dir, new_vm_working_dir, e))
try: try:
if not os.listdir(module_path):
os.rmdir(module_path) os.rmdir(module_path)
except OSError as e: except OSError:
raise aiohttp.web.HTTPInternalServerError(text="Could not delete {}: {}".format(module_path, e)) pass
except FileNotFoundError as e:
log.warning(e)
try: try:
if not os.listdir(project_files_dir):
os.rmdir(project_files_dir) os.rmdir(project_files_dir)
except OSError as e: except OSError:
raise aiohttp.web.HTTPInternalServerError(text="Could not delete {}: {}".format(project_files_dir, e)) pass
except FileNotFoundError as e:
log.warning(e)
if not vm_id: if not vm_id:
vm_id = str(uuid4()) vm_id = str(uuid4())