From 41f12457e7039c98f3ccde36ce554fc97fad7c8f Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Thu, 22 Sep 2016 18:29:46 +0200 Subject: [PATCH] Fix a crash in cloud --- gns3server/compute/builtin/nodes/cloud.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/gns3server/compute/builtin/nodes/cloud.py b/gns3server/compute/builtin/nodes/cloud.py index dc963efc..ebfa47bc 100644 --- a/gns3server/compute/builtin/nodes/cloud.py +++ b/gns3server/compute/builtin/nodes/cloud.py @@ -48,8 +48,7 @@ class Cloud(BaseNode): # If the cloud is not configured we fill it with host interfaces if not ports or len(ports) == 0: self._ports_mapping = [] - network_interfaces = gns3server.utils.interfaces.interfaces() - for interface in network_interfaces: + for interface in self._interfaces(): if not interface["special"]: self._ports_mapping.append({ "interface": interface["name"], @@ -60,6 +59,9 @@ class Cloud(BaseNode): else: self._ports_mapping = ports + def _interfaces(self): + return gns3server.utils.interfaces.interfaces() + def __json__(self): host_interfaces = [] @@ -172,7 +174,7 @@ class Cloud(BaseNode): if port_info["type"] in ("ethernet", "tap"): if sys.platform.startswith("win"): - windows_interfaces = interfaces() + windows_interfaces = self._interfaces() npf = None for interface in windows_interfaces: if port_info["interface"] == interface["name"]: @@ -186,7 +188,7 @@ class Cloud(BaseNode): else: if port_info["type"] == "ethernet": - network_interfaces = [interface["name"] for interface in interfaces()] + network_interfaces = [interface["name"] for interface in self._interfaces()] if not port_info["interface"] in network_interfaces: raise NodeError("Interface '{}' could not be found on this system".format(port_info["interface"]))