mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-24 17:28:08 +00:00
Enable show in file manager for cloud
Fix https://github.com/GNS3/gns3-gui/issues/1900
This commit is contained in:
parent
94d285301a
commit
8b7035b185
@ -81,7 +81,9 @@ class Cloud(BaseNode):
|
|||||||
"project_id": self.project.id,
|
"project_id": self.project.id,
|
||||||
"ports_mapping": self._ports_mapping,
|
"ports_mapping": self._ports_mapping,
|
||||||
"interfaces": host_interfaces,
|
"interfaces": host_interfaces,
|
||||||
"status": self.status}
|
"status": self.status,
|
||||||
|
"node_directory": self.working_dir
|
||||||
|
}
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def ports_mapping(self):
|
def ports_mapping(self):
|
||||||
|
@ -75,7 +75,7 @@ CLOUD_CREATE_SCHEMA = {
|
|||||||
{"$ref": "#/definitions/HostInterfaces"}
|
{"$ref": "#/definitions/HostInterfaces"}
|
||||||
]},
|
]},
|
||||||
]
|
]
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": False,
|
"additionalProperties": False,
|
||||||
"required": ["name"]
|
"required": ["name"]
|
||||||
@ -123,6 +123,10 @@ CLOUD_OBJECT_SCHEMA = {
|
|||||||
]},
|
]},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"node_directory": {
|
||||||
|
"description": "Path to the VM working directory",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"status": {
|
"status": {
|
||||||
"description": "Node status",
|
"description": "Node status",
|
||||||
"enum": ["started", "stopped", "suspended"]
|
"enum": ["started", "stopped", "suspended"]
|
||||||
|
@ -511,7 +511,7 @@ VM_OBJECT_SCHEMA = {
|
|||||||
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
|
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
|
||||||
},
|
},
|
||||||
"node_directory": {
|
"node_directory": {
|
||||||
"decription": "Path to the vm working directory",
|
"description": "Path to the vm working directory",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"project_id": {
|
"project_id": {
|
||||||
|
@ -503,7 +503,7 @@ QEMU_OBJECT_SCHEMA = {
|
|||||||
"enum": ["c", "d", "n", "cn", "cd"]
|
"enum": ["c", "d", "n", "cn", "cd"]
|
||||||
},
|
},
|
||||||
"node_directory": {
|
"node_directory": {
|
||||||
"decription": "Path to the VM working directory",
|
"description": "Path to the VM working directory",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"ram": {
|
"ram": {
|
||||||
|
@ -124,7 +124,7 @@ VBOX_OBJECT_SCHEMA = {
|
|||||||
"enum": ["started", "stopped", "suspended"]
|
"enum": ["started", "stopped", "suspended"]
|
||||||
},
|
},
|
||||||
"node_directory": {
|
"node_directory": {
|
||||||
"decription": "Path to the VM working directory",
|
"description": "Path to the VM working directory",
|
||||||
"type": ["string", "null"]
|
"type": ["string", "null"]
|
||||||
},
|
},
|
||||||
"headless": {
|
"headless": {
|
||||||
|
@ -103,7 +103,7 @@ VMWARE_OBJECT_SCHEMA = {
|
|||||||
"enum": ["started", "stopped", "suspended"]
|
"enum": ["started", "stopped", "suspended"]
|
||||||
},
|
},
|
||||||
"node_directory": {
|
"node_directory": {
|
||||||
"decription": "Path to the node working directory",
|
"description": "Path to the node working directory",
|
||||||
"type": ["string", "null"]
|
"type": ["string", "null"]
|
||||||
},
|
},
|
||||||
"project_id": {
|
"project_id": {
|
||||||
|
@ -109,7 +109,7 @@ VPCS_OBJECT_SCHEMA = {
|
|||||||
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
|
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
|
||||||
},
|
},
|
||||||
"node_directory": {
|
"node_directory": {
|
||||||
"decription": "Path to the VM working directory",
|
"description": "Path to the VM working directory",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"status": {
|
"status": {
|
||||||
|
@ -29,21 +29,29 @@ def nio():
|
|||||||
return NIOUDP(4242, "127.0.0.1", 4343)
|
return NIOUDP(4242, "127.0.0.1", 4343)
|
||||||
|
|
||||||
|
|
||||||
def test_json_with_ports(on_gns3vm, project):
|
@pytest.fixture
|
||||||
|
def manager():
|
||||||
|
m = MagicMock()
|
||||||
|
m.module_name = "builtins"
|
||||||
|
return m
|
||||||
|
|
||||||
|
|
||||||
|
def test_json_with_ports(on_gns3vm, project, manager):
|
||||||
ports = [
|
ports = [
|
||||||
{
|
{
|
||||||
"interface": "virbr0",
|
"interface": "virbr0",
|
||||||
"name": "virbr0",
|
"name": "virbr0",
|
||||||
"port_number": 0,
|
"port_number": 0,
|
||||||
"type": "ethernet"
|
"type": "ethernet",
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
cloud = Cloud("cloud1", str(uuid.uuid4()), project, MagicMock(), ports=ports)
|
cloud = Cloud("cloud1", str(uuid.uuid4()), project, manager, ports=ports)
|
||||||
assert cloud.__json__() == {
|
assert cloud.__json__() == {
|
||||||
"name": "cloud1",
|
"name": "cloud1",
|
||||||
"node_id": cloud.id,
|
"node_id": cloud.id,
|
||||||
"project_id": project.id,
|
"project_id": project.id,
|
||||||
"status": "stopped",
|
"status": "stopped",
|
||||||
|
"node_directory": cloud.working_dir,
|
||||||
"ports_mapping": [
|
"ports_mapping": [
|
||||||
{
|
{
|
||||||
"interface": "virbr0",
|
"interface": "virbr0",
|
||||||
@ -60,16 +68,17 @@ def test_json_with_ports(on_gns3vm, project):
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def test_json_without_ports(on_gns3vm, project):
|
def test_json_without_ports(on_gns3vm, project, manager):
|
||||||
"""
|
"""
|
||||||
If no interface is provide the cloud is prefill with non special interfaces
|
If no interface is provide the cloud is prefill with non special interfaces
|
||||||
"""
|
"""
|
||||||
cloud = Cloud("cloud1", str(uuid.uuid4()), project, MagicMock(), ports=None)
|
cloud = Cloud("cloud1", str(uuid.uuid4()), project, manager, ports=None)
|
||||||
assert cloud.__json__() == {
|
assert cloud.__json__() == {
|
||||||
"name": "cloud1",
|
"name": "cloud1",
|
||||||
"node_id": cloud.id,
|
"node_id": cloud.id,
|
||||||
"project_id": project.id,
|
"project_id": project.id,
|
||||||
"status": "stopped",
|
"status": "stopped",
|
||||||
|
"node_directory": cloud.working_dir,
|
||||||
"ports_mapping": [
|
"ports_mapping": [
|
||||||
{
|
{
|
||||||
"interface": "eth0",
|
"interface": "eth0",
|
||||||
|
Loading…
Reference in New Issue
Block a user