Fix docker console port lost during update

Fix https://github.com/GNS3/gns3-gui/issues/1026
This commit is contained in:
Julien Duponchelle committed 2016-02-12 16:38:16 +01:00
1 parent 85b9620953
commit 01e2fcf225
2 files changed
+7

No files matched your search

+3
View File
@@ -184,8 +184,11 @@ class DockerVM(BaseVM):
"""
Destroy an recreate the container with the new settings
"""
# We need to save the console port and restore it
console = self.console
yield from self.remove()
yield from self.create()
self.console = console
@asyncio.coroutine
def start(self):
+4
View File
@@ -352,6 +352,9 @@ def test_update(loop, vm):
"Id": "e90e34656806",
"Warnings": []
}
original_console = vm.console
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"):
with asyncio_patch("gns3server.modules.docker.Docker.query", return_value=response) as mock_query:
@@ -373,6 +376,7 @@ def test_update(loop, vm):
"Name": "test",
"Image": "ubuntu"
})
assert vm.console == original_console
def test_remove(loop, vm):