mirror of
https://github.com/GNS3/gns3-server.git
synced 2024-12-18 20:37:57 +00:00
Fix crash when project sets 'auto_open' option and a remote GNS3 VM is used. Fixes https://github.com/GNS3/gns3-gui/issues/3014
This commit is contained in:
parent
1cbed45f16
commit
62130c116a
@ -99,11 +99,13 @@ class Controller:
|
||||
await self.add_compute(**c)
|
||||
except (aiohttp.web.HTTPError, KeyError):
|
||||
pass # Skip not available servers at loading
|
||||
await self.load_projects()
|
||||
|
||||
try:
|
||||
await self.gns3vm.auto_start_vm()
|
||||
except GNS3VMError as e:
|
||||
log.warning(str(e))
|
||||
|
||||
await self.load_projects()
|
||||
await self._project_auto_open()
|
||||
|
||||
def _update_config(self):
|
||||
@ -238,7 +240,7 @@ class Controller:
|
||||
if file.endswith(".gns3"):
|
||||
try:
|
||||
await self.load_project(os.path.join(project_dir, file), load=False)
|
||||
except (aiohttp.web.HTTPConflict, NotImplementedError):
|
||||
except (aiohttp.web.HTTPConflict, aiohttp.web.HTTPNotFound, NotImplementedError):
|
||||
pass # Skip not compatible projects
|
||||
except OSError as e:
|
||||
log.error(str(e))
|
||||
|
@ -427,7 +427,7 @@ class Compute:
|
||||
ws_url = self._getUrl("/notifications/ws")
|
||||
try:
|
||||
async with self._session().ws_connect(ws_url, auth=self._auth, heartbeat=10) as ws:
|
||||
log.info("Connected to compute WebSocket '{}'".format(ws_url))
|
||||
log.info("Connected to compute '{}' WebSocket '{}'".format(self._id, ws_url))
|
||||
async for response in ws:
|
||||
if response.type == aiohttp.WSMsgType.TEXT:
|
||||
msg = json.loads(response.data)
|
||||
@ -445,15 +445,15 @@ class Compute:
|
||||
if response.type == aiohttp.WSMsgType.CLOSE:
|
||||
await ws.close()
|
||||
elif response.type == aiohttp.WSMsgType.ERROR:
|
||||
log.error("Error received on compute WebSocket '{}': {}".format(ws_url, ws.exception()))
|
||||
log.error("Error received on compute '{}' WebSocket '{}': {}".format(self._id, ws_url, ws.exception()))
|
||||
elif response.type == aiohttp.WSMsgType.CLOSED:
|
||||
pass
|
||||
break
|
||||
except aiohttp.client_exceptions.ClientResponseError as e:
|
||||
log.error("Client response error received on compute WebSocket '{}': {}".format(ws_url,e))
|
||||
log.error("Client response error received on compute '{}' WebSocket '{}': {}".format(self._id, ws_url,e))
|
||||
finally:
|
||||
self._connected = False
|
||||
log.info("Connection closed to compute WebSocket '{}'".format(ws_url))
|
||||
log.info("Connection closed to compute '{}' WebSocket '{}'".format(self._id, ws_url))
|
||||
|
||||
# Try to reconnect after 1 second if server unavailable only if not during tests (otherwise we create a ressources usage bomb)
|
||||
if not hasattr(sys, "_called_from_test") or not sys._called_from_test:
|
||||
|
@ -51,7 +51,6 @@ class RemoteGNS3VM(BaseGNS3VM):
|
||||
|
||||
if not self.vmname:
|
||||
return
|
||||
vm_compute = None
|
||||
for compute in self._controller.computes.values():
|
||||
if compute.name == self.vmname:
|
||||
self.running = True
|
||||
|
@ -133,7 +133,7 @@ class CrashReport:
|
||||
for key, value in extra_context.items():
|
||||
scope.set_extra(key, value)
|
||||
|
||||
def capture_exception(self, request):
|
||||
def capture_exception(self, request=None):
|
||||
|
||||
if not SENTRY_SDK_AVAILABLE:
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user