1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-13 20:08:55 +00:00

Fix the server don't start if a remote is unavailable

This commit is contained in:
Julien Duponchelle 2017-02-06 10:49:09 +01:00
parent 959c08449e
commit d06af526b2
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8
2 changed files with 4 additions and 6 deletions

View File

@ -16,7 +16,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
import os import os
import sys
import json import json
import socket import socket
import asyncio import asyncio
@ -318,7 +317,6 @@ class Controller:
try: try:
return self._computes[compute_id] return self._computes[compute_id]
except KeyError: except KeyError:
server_config = Config.instance().get_section_config("Server")
if compute_id == "vm": if compute_id == "vm":
raise aiohttp.web.HTTPNotFound(text="You try to use a node on the GNS3 VM server but the GNS3 VM is not configured") raise aiohttp.web.HTTPNotFound(text="You try to use a node on the GNS3 VM server but the GNS3 VM is not configured")
raise aiohttp.web.HTTPNotFound(text="Compute ID {} doesn't exist".format(compute_id)) raise aiohttp.web.HTTPNotFound(text="Compute ID {} doesn't exist".format(compute_id))

View File

@ -22,14 +22,12 @@ import socket
import json import json
import uuid import uuid
import sys import sys
import os
import io import io
from ..utils import parse_version from ..utils import parse_version
from ..utils.images import list_images, md5sum from ..utils.images import list_images
from ..utils.asyncio import locked_coroutine from ..utils.asyncio import locked_coroutine
from ..controller.controller_error import ControllerError from ..controller.controller_error import ControllerError
from ..config import Config
from ..version import __version__ from ..version import __version__
@ -381,7 +379,9 @@ class Compute:
except aiohttp.web.HTTPNotFound: except aiohttp.web.HTTPNotFound:
raise aiohttp.web.HTTPConflict(text="The server {} is not a GNS3 server or it's a 1.X server".format(self._id)) raise aiohttp.web.HTTPConflict(text="The server {} is not a GNS3 server or it's a 1.X server".format(self._id))
except aiohttp.web.HTTPUnauthorized: except aiohttp.web.HTTPUnauthorized:
raise aiohttp.web.HTTPConflict(text="Invalid auth for server {} ".format(self._id)) raise aiohttp.web.HTTPConflict(text="Invalid auth for server {}".format(self._id))
except aiohttp.web.HTTPServiceUnavailable:
raise aiohttp.web.HTTPConflict(text="The server {} is unavailable".format(self._id))
if "version" not in response.json: if "version" not in response.json:
self._http_session.close() self._http_session.close()