Merge remote-tracking branch 'origin/2.0' into 2.0

Conflicts:
	gns3server/controller/project.py
	tests/compute/test_project.py
	tests/controller/test_project.py
This commit is contained in:
grossmj committed 2016-05-11 11:41:45 -06:00
commit 483431438a
17 files changed
+208 -53

No files matched your search

+23
View File
@@ -91,14 +91,35 @@ class Controller:
"""
Add a server to the dictionnary of computes controlled by GNS3
:param compute_id: Id of the compute node
:param kwargs: See the documentation of Compute
"""
# We dissallow to create from the outside the
if compute_id == 'local':
return self._createLocalCompute()
if compute_id not in self._computes:
compute = Compute(compute_id=compute_id, controller=self, **kwargs)
self._computes[compute_id] = compute
self.save()
return self._computes[compute_id]
def _createLocalCompute(self):
"""
Create the local compute node. It's the controller itself
"""
server_config = Config.instance().get_section_config("Server")
self._computes["local"] = Compute(
compute_id="local",
controller=self,
protocol=server_config.get("protocol", "http"),
host=server_config.get("host", "localhost"),
port=server_config.getint("port", 3080),
user=server_config.get("user", ""),
password=server_config.get("password", ""))
return self._computes["local"]
@property
def computes(self):
"""
@@ -113,6 +134,8 @@ class Controller:
try:
return self._computes[compute_id]
except KeyError:
if compute_id == "local":
return self._createLocalCompute()
raise aiohttp.web.HTTPNotFound(text="Compute ID {} doesn't exist".format(compute_id))
@asyncio.coroutine