mirror of
https://github.com/GNS3/gns3-server.git
synced 2025-01-31 13:23:48 +02:00
Fix docker console port lost during update
Fix https://github.com/GNS3/gns3-gui/issues/1026
This commit is contained in:
parent
85b9620953
commit
01e2fcf225
@ -184,8 +184,11 @@ class DockerVM(BaseVM):
|
|||||||
"""
|
"""
|
||||||
Destroy an recreate the container with the new settings
|
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.remove()
|
||||||
yield from self.create()
|
yield from self.create()
|
||||||
|
self.console = console
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def start(self):
|
def start(self):
|
||||||
|
@ -352,6 +352,9 @@ def test_update(loop, vm):
|
|||||||
"Id": "e90e34656806",
|
"Id": "e90e34656806",
|
||||||
"Warnings": []
|
"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.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.DockerVM._get_container_state", return_value="stopped"):
|
||||||
with asyncio_patch("gns3server.modules.docker.Docker.query", return_value=response) as mock_query:
|
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",
|
"Name": "test",
|
||||||
"Image": "ubuntu"
|
"Image": "ubuntu"
|
||||||
})
|
})
|
||||||
|
assert vm.console == original_console
|
||||||
|
|
||||||
|
|
||||||
def test_remove(loop, vm):
|
def test_remove(loop, vm):
|
||||||
|
Loading…
Reference in New Issue
Block a user