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

Fix docker console port lost during update

Fix https://github.com/GNS3/gns3-gui/issues/1026
This commit is contained in:
Julien Duponchelle 2016-02-12 16:38:16 +01:00
parent 85b9620953
commit 01e2fcf225
No known key found for this signature in database
GPG Key ID: F1E2485547D4595D
2 changed files with 7 additions and 0 deletions

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):

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):