Use HTTP error 409 instead of 500 for VMError.

pull/100/head
grossmj 9 years ago
parent d65617657c
commit 610dee957d

@ -1495,10 +1495,10 @@ class Router(BaseVM):
try:
reply = yield from self._hypervisor.send("vm extract_config {}".format(self._name))
reply = reply[0].rsplit(' ', 2)[-2:]
except IOError:
except DynamipsError:
#for some reason Dynamips gets frozen when it does not find the magic number in the NVRAM file.
return None, None
reply = reply[0].rsplit(' ', 2)[-2:]
startup_config = reply[0][1:-1] # get statup-config and remove single quotes
private_config = reply[1][1:-1] # get private-config and remove single quotes
return startup_config, private_config

@ -115,8 +115,8 @@ class Route(object):
except VMError as e:
log.error("VM error detected: {type}".format(type=type(e)), exc_info=1)
response = Response(route=route)
response.set_status(500)
response.json({"message": str(e), "status": 500})
response.set_status(409)
response.json({"message": str(e), "status": 409})
except Exception as e:
log.error("Uncaught exception detected: {type}".format(type=type(e)), exc_info=1)
response = Response(route=route)

Loading…
Cancel
Save