mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-28 11:18:11 +00:00
parent
a9b95eb242
commit
1eb77a0b3f
@ -195,7 +195,7 @@ class DockerVM(BaseNode):
|
|||||||
"""
|
"""
|
||||||
:returns: Return the path that we need to map to local folders
|
:returns: Return the path that we need to map to local folders
|
||||||
"""
|
"""
|
||||||
binds = ["{}:/gns3:ro".format(get_resource("hypervisor/docker/resources"))]
|
binds = ["{}:/gns3:ro".format(get_resource("compute/docker/resources"))]
|
||||||
|
|
||||||
# We mount our own etc/network
|
# We mount our own etc/network
|
||||||
network_config = self._create_network_config()
|
network_config = self._create_network_config()
|
||||||
|
@ -154,9 +154,10 @@ class Node:
|
|||||||
data["name"] = self._name
|
data["name"] = self._name
|
||||||
if self._console:
|
if self._console:
|
||||||
data["console"] = self._console
|
data["console"] = self._console
|
||||||
|
if self._console_type:
|
||||||
data["console_type"] = self._console_type
|
data["console_type"] = self._console_type
|
||||||
|
|
||||||
# None properties should be send. Because it can mean the emulator doesn't support it
|
# None properties are not be send. Because it can mean the emulator doesn't support it
|
||||||
for key in list(data.keys()):
|
for key in list(data.keys()):
|
||||||
if data[key] is None:
|
if data[key] is None:
|
||||||
del data[key]
|
del data[key]
|
||||||
|
@ -81,9 +81,7 @@ class DockerHandler:
|
|||||||
400: "Invalid request",
|
400: "Invalid request",
|
||||||
404: "Instance doesn't exist"
|
404: "Instance doesn't exist"
|
||||||
},
|
},
|
||||||
description="Start a Docker container",
|
description="Start a Docker container")
|
||||||
input=DOCKER_CREATE_SCHEMA,
|
|
||||||
output=DOCKER_OBJECT_SCHEMA)
|
|
||||||
def start(request, response):
|
def start(request, response):
|
||||||
docker_manager = Docker.instance()
|
docker_manager = Docker.instance()
|
||||||
container = docker_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
|
container = docker_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
|
||||||
@ -101,9 +99,7 @@ class DockerHandler:
|
|||||||
400: "Invalid request",
|
400: "Invalid request",
|
||||||
404: "Instance doesn't exist"
|
404: "Instance doesn't exist"
|
||||||
},
|
},
|
||||||
description="Stop a Docker container",
|
description="Stop a Docker container")
|
||||||
input=DOCKER_CREATE_SCHEMA,
|
|
||||||
output=DOCKER_OBJECT_SCHEMA)
|
|
||||||
def stop(request, response):
|
def stop(request, response):
|
||||||
docker_manager = Docker.instance()
|
docker_manager = Docker.instance()
|
||||||
container = docker_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
|
container = docker_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
|
||||||
@ -121,9 +117,7 @@ class DockerHandler:
|
|||||||
400: "Invalid request",
|
400: "Invalid request",
|
||||||
404: "Instance doesn't exist"
|
404: "Instance doesn't exist"
|
||||||
},
|
},
|
||||||
description="Restart a Docker container",
|
description="Restart a Docker container")
|
||||||
input=DOCKER_CREATE_SCHEMA,
|
|
||||||
output=DOCKER_OBJECT_SCHEMA)
|
|
||||||
def reload(request, response):
|
def reload(request, response):
|
||||||
docker_manager = Docker.instance()
|
docker_manager = Docker.instance()
|
||||||
container = docker_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
|
container = docker_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
|
||||||
@ -159,9 +153,7 @@ class DockerHandler:
|
|||||||
400: "Invalid request",
|
400: "Invalid request",
|
||||||
404: "Instance doesn't exist"
|
404: "Instance doesn't exist"
|
||||||
},
|
},
|
||||||
description="Pause a Docker container",
|
description="Pause a Docker container")
|
||||||
input=DOCKER_CREATE_SCHEMA,
|
|
||||||
output=DOCKER_OBJECT_SCHEMA)
|
|
||||||
def pause(request, response):
|
def pause(request, response):
|
||||||
docker_manager = Docker.instance()
|
docker_manager = Docker.instance()
|
||||||
container = docker_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
|
container = docker_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
|
||||||
@ -179,9 +171,7 @@ class DockerHandler:
|
|||||||
400: "Invalid request",
|
400: "Invalid request",
|
||||||
404: "Instance doesn't exist"
|
404: "Instance doesn't exist"
|
||||||
},
|
},
|
||||||
description="Unpause a Docker container",
|
description="Unpause a Docker container")
|
||||||
input=DOCKER_CREATE_SCHEMA,
|
|
||||||
output=DOCKER_OBJECT_SCHEMA)
|
|
||||||
def unpause(request, response):
|
def unpause(request, response):
|
||||||
docker_manager = Docker.instance()
|
docker_manager = Docker.instance()
|
||||||
container = docker_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
|
container = docker_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
|
||||||
|
@ -86,6 +86,7 @@ DOCKER_CREATE_SCHEMA = {
|
|||||||
|
|
||||||
},
|
},
|
||||||
"additionalProperties": False,
|
"additionalProperties": False,
|
||||||
|
"required": ["name", "image"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user