mirror of
https://github.com/GNS3/gns3-server
synced 2024-12-26 16:58:28 +00:00
Merge remote-tracking branch 'origin/2.1' into 2.1
This commit is contained in:
commit
26567d9164
@ -522,10 +522,16 @@ class Compute:
|
|||||||
else:
|
else:
|
||||||
data = json.dumps(data).encode("utf-8")
|
data = json.dumps(data).encode("utf-8")
|
||||||
try:
|
try:
|
||||||
|
log.debug("Attempting request to compute: {method} {url} {headers}".format(
|
||||||
|
method=method,
|
||||||
|
url=url,
|
||||||
|
headers=headers
|
||||||
|
))
|
||||||
response = yield from self._session().request(method, url, headers=headers, data=data, auth=self._auth, chunked=chunked, timeout=timeout)
|
response = yield from self._session().request(method, url, headers=headers, data=data, auth=self._auth, chunked=chunked, timeout=timeout)
|
||||||
except asyncio.TimeoutError as e:
|
except asyncio.TimeoutError as e:
|
||||||
raise ComputeError("Timeout error when connecting to {}".format(url))
|
raise ComputeError("Timeout error when connecting to {}".format(url))
|
||||||
except (aiohttp.ClientError, aiohttp.ServerDisconnectedError, ValueError, KeyError) as e:
|
except (aiohttp.ClientError, aiohttp.ServerDisconnectedError, ValueError, KeyError, socket.gaierror) as e:
|
||||||
|
# aiohttp 2.3.1 raises socket.gaierror when cannot find host
|
||||||
raise ComputeError(str(e))
|
raise ComputeError(str(e))
|
||||||
body = yield from response.read()
|
body = yield from response.read()
|
||||||
if body and not raw:
|
if body and not raw:
|
||||||
|
@ -42,8 +42,8 @@ import gns3server.handlers
|
|||||||
import logging
|
import logging
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
if not aiohttp.__version__.startswith("2.2"):
|
if not (aiohttp.__version__.startswith("2.2") or aiohttp.__version__.startswith("2.3")):
|
||||||
raise RuntimeError("aiohttp 2.2 is required to run the GNS3 server")
|
raise RuntimeError("aiohttp 2.2.x or 2.3.x is required to run the GNS3 server")
|
||||||
|
|
||||||
|
|
||||||
class WebServer:
|
class WebServer:
|
||||||
@ -101,7 +101,12 @@ class WebServer:
|
|||||||
if self._app:
|
if self._app:
|
||||||
yield from self._app.shutdown()
|
yield from self._app.shutdown()
|
||||||
if self._handler:
|
if self._handler:
|
||||||
yield from self._handler.finish_connections(2) # Parameter is timeout
|
try:
|
||||||
|
# aiohttp < 2.3
|
||||||
|
yield from self._handler.finish_connections(2) # Parameter is timeout
|
||||||
|
except AttributeError:
|
||||||
|
# aiohttp >= 2.3
|
||||||
|
yield from self._handler.shutdown(2) # Parameter is timeout
|
||||||
if self._app:
|
if self._app:
|
||||||
yield from self._app.cleanup()
|
yield from self._app.cleanup()
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
jsonschema>=2.4.0
|
jsonschema>=2.4.0
|
||||||
aiohttp>=2.2.0,<2.3.0 # pyup: ignore
|
aiohttp>=2.2.0,<2.4.0 # pyup: ignore
|
||||||
aiohttp-cors>=0.5.3,<0.6.0 # pyup: ignore
|
aiohttp-cors>=0.5.3,<0.6.0 # pyup: ignore
|
||||||
yarl>=0.11,<0.12 # pyup: ignore
|
yarl>=0.11,<0.12 # pyup: ignore
|
||||||
Jinja2>=2.7.3
|
Jinja2>=2.7.3
|
||||||
|
Loading…
Reference in New Issue
Block a user