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

Fix move a docker restart it

Fix #832
This commit is contained in:
Julien Duponchelle 2016-12-14 19:21:50 +01:00
parent 74a7e630d3
commit f3e9917479
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8

View File

@ -243,16 +243,20 @@ class DockerHandler:
docker_manager = Docker.instance()
container = docker_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
container.name = request.json.get("name", container.name)
container.console = request.json.get("console", container.console)
container.aux = request.json.get("aux", container.aux)
container.console_type = request.json.get("console_type", container.console_type)
container.console_resolution = request.json.get("console_resolution", container.console_resolution)
container.console_http_port = request.json.get("console_http_port", container.console_http_port)
container.console_http_path = request.json.get("console_http_path", container.console_http_path)
container.start_command = request.json.get("start_command", container.start_command)
container.environment = request.json.get("environment", container.environment)
container.adapters = request.json.get("adapters", container.adapters)
props = [
"name", "console", "aux", "console_type", "console_resolution",
"console_http_port", "console_http_path", "start_command",
"environment", "adapters"
]
changed = False
for prop in props:
if prop in request.json and request.json[prop] != getattr(container, prop):
setattr(container, prop, request.json[prop])
changed = True
# We don't call container.update for nothing because it will restart the container
if changed:
yield from container.update()
container.updated()
response.json(container)