1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-15 12:59:06 +00:00

Fixes KeyError: "ethernet0.connectiontype". Fixes #276.

This commit is contained in:
Jeremy 2015-07-27 15:50:09 -06:00
parent 1419b7c8dc
commit a721d7d910

View File

@ -199,7 +199,7 @@ class VMwareVM(BaseVM):
# check if any vmnet interface managed by GNS3 is being used on existing VMware adapters
if self._get_vmx_setting("ethernet{}.present".format(adapter_number), "TRUE"):
connection_type = "ethernet{}.connectiontype".format(adapter_number)
if self._vmx_pairs[connection_type] in ("hostonly", "custom"):
if connection_type in self._vmx_pairs and self._vmx_pairs[connection_type] in ("hostonly", "custom"):
vnet = "ethernet{}.vnet".format(adapter_number)
if vnet in self._vmx_pairs:
vmnet = os.path.basename(self._vmx_pairs[vnet])
@ -217,8 +217,7 @@ class VMwareVM(BaseVM):
if self._get_vmx_setting("ethernet{}.present".format(adapter_number), "TRUE"):
# check for the connection type
connection_type = "ethernet{}.connectiontype".format(adapter_number)
if connection_type in self._vmx_pairs:
if self._vmx_pairs[connection_type] in ("nat", "bridged", "hostonly"):
if connection_type in self._vmx_pairs and self._vmx_pairs[connection_type] in ("nat", "bridged", "hostonly"):
raise VMwareError("Attachment ({}) already configured on network adapter {}. "
"Please remove it or allow GNS3 to use any adapter.".format(self._vmx_pairs[connection_type],
adapter_number))