From 2651a48102b92c25dba6a6275fb6a0b918ce7626 Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Tue, 5 Apr 2016 16:33:40 +0200 Subject: [PATCH] Fix the docker aux port is lost after an update Fix https://github.com/GNS3/gns3-gui/issues/1155 --- gns3server/modules/docker/docker_vm.py | 2 ++ tests/modules/docker/test_docker_vm.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/gns3server/modules/docker/docker_vm.py b/gns3server/modules/docker/docker_vm.py index c9ef0736..2513e7ff 100644 --- a/gns3server/modules/docker/docker_vm.py +++ b/gns3server/modules/docker/docker_vm.py @@ -269,11 +269,13 @@ class DockerVM(BaseVM): """ # We need to save the console and state and restore it console = self.console + aux = self.aux state = yield from self._get_container_state() yield from self.close() yield from self.create() self.console = console + self.aux = aux if state == "running": yield from self.start() diff --git a/tests/modules/docker/test_docker_vm.py b/tests/modules/docker/test_docker_vm.py index 0a6a3a82..de1858ca 100644 --- a/tests/modules/docker/test_docker_vm.py +++ b/tests/modules/docker/test_docker_vm.py @@ -451,6 +451,7 @@ def test_update(loop, vm): } original_console = vm.console + original_aux = vm.aux with asyncio_patch("gns3server.modules.docker.Docker.list_images", return_value=[{"image": "ubuntu"}]) as mock_list_images: with asyncio_patch("gns3server.modules.docker.DockerVM._get_container_state", return_value="stopped"): @@ -481,6 +482,7 @@ def test_update(loop, vm): "Cmd": ["/bin/sh"] }) assert vm.console == original_console + assert vm.aux == original_aux def test_update_running(loop, vm):