mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 14:01:15 +02:00
Fix tests about local compute node
This commit is contained in:
7 files changed
+54
-75
No files matched your search
@@ -77,16 +77,23 @@ class Controller:
|
||||
"""
|
||||
Save the controller configuration on disk
|
||||
"""
|
||||
data = {"computes": [{"host": c.host,
|
||||
"name": c.name,
|
||||
"port": c.port,
|
||||
"protocol": c.protocol,
|
||||
"user": c.user,
|
||||
"password": c.password,
|
||||
"compute_id": c.id
|
||||
} for c in self._computes.values()],
|
||||
"settings": self._settings,
|
||||
"version": __version__}
|
||||
data = {
|
||||
"computes": [],
|
||||
"settings": self._settings,
|
||||
"version": __version__
|
||||
}
|
||||
|
||||
for c in self._computes.values():
|
||||
if c.id != "local":
|
||||
data["computes"].append({
|
||||
"host": c.host,
|
||||
"name": c.name,
|
||||
"port": c.port,
|
||||
"protocol": c.protocol,
|
||||
"user": c.user,
|
||||
"password": c.password,
|
||||
"compute_id": c.id
|
||||
})
|
||||
os.makedirs(os.path.dirname(self._config_file), exist_ok=True)
|
||||
with open(self._config_file, 'w+') as f:
|
||||
json.dump(data, f, indent=4)
|
||||
|
||||
@@ -96,10 +96,6 @@ class Compute:
|
||||
# Websocket for notifications
|
||||
self._ws = None
|
||||
|
||||
# It's a configuration issue if the compute is not configured to be local but the compute id is local
|
||||
if compute_id == "local" and Config.instance().get_section_config("Server")["local"] is False:
|
||||
raise ComputeError("The local compute is started without --local")
|
||||
|
||||
def _session(self):
|
||||
if self._http_session is None or self._http_session.closed is True:
|
||||
self._http_session = aiohttp.ClientSession()
|
||||
|
||||
@@ -35,6 +35,7 @@ def process_websocket(ws):
|
||||
|
||||
|
||||
class NotificationHandler:
|
||||
|
||||
@Route.get(
|
||||
r"/notifications/ws",
|
||||
description="Send notifications using Websockets")
|
||||
|
||||
Reference in new issue
Block a user