Temporary fix for remote GNS3 VM support

Ref #623
This commit is contained in:
Julien Duponchelle 2016-07-19 13:26:27 +02:00
parent 2977b1059e
commit dd63ca6ef1
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8

View File

@ -126,7 +126,6 @@ class Controller:
with open(config_file) as f: with open(config_file) as f:
data = json.load(f) data = json.load(f)
for remote in data.get("Servers", {}).get("remote_servers", []): for remote in data.get("Servers", {}).get("remote_servers", []):
print("a")
yield from self.add_compute( yield from self.add_compute(
host=remote.get("host", "localhost"), host=remote.get("host", "localhost"),
port=remote.get("port", 3080), port=remote.get("port", 3080),
@ -166,8 +165,8 @@ class Controller:
""" """
if compute_id not in self._computes: if compute_id not in self._computes:
# We disallow to create from the outside the # We disallow to create from the outside the local and VM server
if compute_id == 'local': if compute_id == 'local' or compute_id == 'vm':
return None return None
for compute in self._computes.values(): for compute in self._computes.values():
@ -178,6 +177,13 @@ class Controller:
self._computes[compute.id] = compute self._computes[compute.id] = compute
self.save() self.save()
self.notification.emit("compute.created", compute.__json__()) self.notification.emit("compute.created", compute.__json__())
#FIXME: temporary before the remote GNS3 VM support is back
if "vm" not in self._computes and not hasattr(sys, "_called_from_test"):
compute_vm = Compute(compute_id="vm", controller=self, name="GNS3 VM", **kwargs)
self._computes[compute_vm.id] = compute_vm
self.notification.emit("compute.created", compute_vm.__json__())
return compute return compute
else: else:
self.notification.emit("compute.updated", self._computes[compute_id].__json__()) self.notification.emit("compute.updated", self._computes[compute_id].__json__())