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

Fix docker support on 2.0

Fix #528
This commit is contained in:
Julien Duponchelle 2016-05-16 18:32:29 +02:00
parent a9b95eb242
commit 1eb77a0b3f
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8
4 changed files with 9 additions and 17 deletions

View File

@ -195,7 +195,7 @@ class DockerVM(BaseNode):
"""
: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
network_config = self._create_network_config()

View File

@ -154,9 +154,10 @@ class Node:
data["name"] = self._name
if self._console:
data["console"] = self._console
if 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()):
if data[key] is None:
del data[key]

View File

@ -81,9 +81,7 @@ class DockerHandler:
400: "Invalid request",
404: "Instance doesn't exist"
},
description="Start a Docker container",
input=DOCKER_CREATE_SCHEMA,
output=DOCKER_OBJECT_SCHEMA)
description="Start a Docker container")
def start(request, response):
docker_manager = Docker.instance()
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",
404: "Instance doesn't exist"
},
description="Stop a Docker container",
input=DOCKER_CREATE_SCHEMA,
output=DOCKER_OBJECT_SCHEMA)
description="Stop a Docker container")
def stop(request, response):
docker_manager = Docker.instance()
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",
404: "Instance doesn't exist"
},
description="Restart a Docker container",
input=DOCKER_CREATE_SCHEMA,
output=DOCKER_OBJECT_SCHEMA)
description="Restart a Docker container")
def reload(request, response):
docker_manager = Docker.instance()
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",
404: "Instance doesn't exist"
},
description="Pause a Docker container",
input=DOCKER_CREATE_SCHEMA,
output=DOCKER_OBJECT_SCHEMA)
description="Pause a Docker container")
def pause(request, response):
docker_manager = Docker.instance()
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",
404: "Instance doesn't exist"
},
description="Unpause a Docker container",
input=DOCKER_CREATE_SCHEMA,
output=DOCKER_OBJECT_SCHEMA)
description="Unpause a Docker container")
def unpause(request, response):
docker_manager = Docker.instance()
container = docker_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])

View File

@ -86,6 +86,7 @@ DOCKER_CREATE_SCHEMA = {
},
"additionalProperties": False,
"required": ["name", "image"]
}