1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-12-26 00:38:10 +00:00

Do not prevent a project to be deleted. Fixes #2237.

This commit is contained in:
grossmj 2017-09-06 18:12:22 +07:00
parent b538bd0a29
commit 4a2dfb0037
2 changed files with 8 additions and 3 deletions

View File

@ -680,8 +680,13 @@ class Project:
@asyncio.coroutine @asyncio.coroutine
def delete(self): def delete(self):
if self._status != "opened": if self._status != "opened":
try:
yield from self.open() yield from self.open()
except aiohttp.web.HTTPConflict as e:
# ignore missing images or other conflicts when deleting a project
log.warning("Conflict while deleting project: {}".format(e.text))
yield from self.delete_on_computes() yield from self.delete_on_computes()
yield from self.close() yield from self.close()
try: try:

View File

@ -211,12 +211,12 @@ class Route(object):
response = Response(request=request, route=route) response = Response(request=request, route=route)
response.set_status(409) response.set_status(409)
response.json({"message": str(e), "status": 409, "exception": e.__class__.__name__}) response.json({"message": str(e), "status": 409, "exception": e.__class__.__name__})
except (ImageMissingError) as e: except ImageMissingError as e:
log.error("Image missing error detected: {}".format(e.image)) log.error("Image missing error detected: {}".format(e.image))
response = Response(request=request, route=route) response = Response(request=request, route=route)
response.set_status(409) response.set_status(409)
response.json({"message": str(e), "status": 409, "image": e.image, "exception": e.__class__.__name__}) response.json({"message": str(e), "status": 409, "image": e.image, "exception": e.__class__.__name__})
except asyncio.futures.CancelledError as e: except asyncio.futures.CancelledError:
response = Response(request=request, route=route) response = Response(request=request, route=route)
response.set_status(408) response.set_status(408)
response.json({"message": "Request canceled", "status": 408}) response.json({"message": "Request canceled", "status": 408})