1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-30 20:28:08 +00:00

Fix bug with custom adapters and categories for Docker VM. Fixes https://github.com/GNS3/gns3-gui/issues/2613

This commit is contained in:
grossmj 2018-11-17 21:50:00 +07:00
parent aa4593c993
commit 74e1463015
4 changed files with 8 additions and 5 deletions

View File

@ -636,7 +636,7 @@ class Node:
break
port_name = "eth{}".format(adapter_number)
port_name = custom_adapter_settings.get("port_name", port_name)
self._ports.append(PortFactory(port_name, 0, adapter_number, 0, "ethernet", short_name="eth{}".format(adapter_number)))
self._ports.append(PortFactory(port_name, 0, adapter_number, 0, "ethernet", short_name=port_name))
elif self._node_type in ("ethernet_switch", "ethernet_hub"):
# Basic node we don't want to have adapter number
port_number = 0

View File

@ -102,7 +102,7 @@ DOCKER_CREATE_SCHEMA = {
"maxLength": 64,
"pattern": "^[a-f0-9]+$"
},
"custom_adapters": CUSTOM_ADAPTERS_ARRAY_SCHEMA # not used at this time
"custom_adapters": CUSTOM_ADAPTERS_ARRAY_SCHEMA
},
"additionalProperties": False,
"required": ["name", "image"]
@ -206,7 +206,7 @@ DOCKER_OBJECT_SCHEMA = {
"description": "VM status Read only",
"enum": ["started", "stopped", "suspended"]
},
"custom_adapters": CUSTOM_ADAPTERS_ARRAY_SCHEMA # not used at this time
"custom_adapters": CUSTOM_ADAPTERS_ARRAY_SCHEMA
},
"additionalProperties": False,
}

View File

@ -17,6 +17,7 @@
import copy
from .appliance import BASE_APPLIANCE_PROPERTIES
from .custom_adapters import CUSTOM_ADAPTERS_ARRAY_SCHEMA
DOCKER_APPLIANCE_PROPERTIES = {
@ -75,7 +76,8 @@ DOCKER_APPLIANCE_PROPERTIES = {
"description": "Docker extra hosts (added to /etc/hosts)",
"type": "string",
"default": "",
}
},
"custom_adapters": CUSTOM_ADAPTERS_ARRAY_SCHEMA
}
DOCKER_APPLIANCE_PROPERTIES.update(copy.deepcopy(BASE_APPLIANCE_PROPERTIES))

View File

@ -636,7 +636,8 @@ def test_docker_appliance_create(http_controller):
"image": "gns3/endhost:latest",
"name": "Docker appliance",
"start_command": "",
"symbol": ":/symbols/docker_guest.svg"}
"symbol": ":/symbols/docker_guest.svg",
"custom_adapters": []}
for item, value in expected_response.items():
assert response.json.get(item) == value