Show version for debug

This commit is contained in:
Julien Duponchelle
2016-05-11 16:31:16 +02:00
parent 95d2bd0065
commit a0344576ba
4 changed files with 29 additions and 2 deletions

View File

@ -51,6 +51,7 @@ class Compute:
self._controller = controller
self._setAuth(user, password)
self._session = aiohttp.ClientSession()
self._version = None
# If the compute is local but the compute id is local
# it's a configuration issue
@ -71,6 +72,20 @@ class Compute:
else:
self._auth = None
@property
def version(self):
"""
:returns: Version of compute node (string or None if not connected)
"""
return self._version
@property
def connected(self):
"""
:returns: True if compute node is connected
"""
return self._connected
@property
def id(self):
"""
@ -160,6 +175,7 @@ class Compute:
if "version" not in response.json:
raise aiohttp.web.HTTPConflict(text="The server {} is not a GNS3 server".format(self._id))
self._version = response.json["version"]
if parse_version(__version__)[:2] != parse_version(response.json["version"])[:2]:
raise aiohttp.web.HTTPConflict(text="The server {} versions are not compatible {} != {}".format(self._id, __version__, response.json["version"]))