Merge branch '2.1' into 2.2

# Conflicts:
#	gns3server/version.py
#	requirements.txt
This commit is contained in:
grossmj committed 2018-06-10 21:19:55 +07:00
commit 96d5e351f7
235 files changed
+3037 -864

No files matched your search

+6 -5
View File
@@ -337,12 +337,13 @@ class Compute:
return response
@asyncio.coroutine
def stream_file(self, project, path):
def stream_file(self, project, path, timeout=None):
"""
Read file of a project and stream it
:param project: A project object
:param path: The path of the file in the project
:param timeout: timeout
:returns: A file stream
"""
@@ -361,7 +362,7 @@ class Compute:
self._response.close()
url = self._getUrl("/projects/{}/stream/{}".format(project.id, path))
response = yield from self._session().request("GET", url, auth=self._auth, timeout=None)
response = yield from self._session().request("GET", url, auth=self._auth, timeout=timeout)
if response.status == 404:
raise aiohttp.web.HTTPNotFound(text="{} not found on compute".format(path))
elif response.status == 403:
@@ -527,8 +528,8 @@ class Compute:
headers=headers
))
response = yield from self._session().request(method, url, headers=headers, data=data, auth=self._auth, chunked=chunked, timeout=timeout)
except asyncio.TimeoutError as e:
raise ComputeError("Timeout error when connecting to {}".format(url))
except asyncio.TimeoutError:
raise ComputeError("Timeout error for {} call to {} after {}s".format(method, url, timeout))
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))
@@ -641,7 +642,7 @@ class Compute:
List files in the project on computes
"""
path = "/projects/{}/files".format(project.id)
res = yield from self.http_query("GET", path, timeout=120)
res = yield from self.http_query("GET", path, timeout=None)
return res.json
@asyncio.coroutine
+5 -3
View File
@@ -248,6 +248,7 @@ class Node:
@symbol.setter
def symbol(self, val):
if val is None:
val = ":/symbols/computer.svg"
@@ -261,8 +262,9 @@ class Node:
self._symbol = val
try:
self._width, self._height, filetype = self._project.controller.symbols.get_size(val)
# If symbol is invalid we replace it by default
except (ValueError, OSError):
except (ValueError, OSError) as e:
log.error("Could not write symbol: {}".format(e))
# If symbol is invalid we replace it by the default
self.symbol = ":/symbols/computer.svg"
if self._label is None:
# Apply to label user style or default
@@ -336,7 +338,7 @@ class Node:
self._links.remove(link)
@property
def link(self):
def links(self):
return self._links
@asyncio.coroutine