From 812ff6b5d8832ba88f13a61ab8476c4b4c3d5c66 Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Wed, 17 May 2017 08:30:16 +0200 Subject: [PATCH 01/33] Update sphinx from 1.5.6 to 1.6.1 (#1035) --- dev-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index 0d474df5..f0f87d96 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,6 +1,6 @@ -rrequirements.txt -sphinx==1.5.6 +sphinx==1.6.1 pytest==3.0.7 pep8==1.7.0 pytest-catchlog==1.2.2 From bdcadcc335b112a8b09c640797020a234675be1f Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Fri, 19 May 2017 17:49:39 +0200 Subject: [PATCH 02/33] Fix support from some old topologies Fix #1038 --- gns3server/controller/topology.py | 6 +- .../after/1_3_dynamips.gns3 | 77 ++++++++++++++++++ .../before/1_3_dynamips.gns3 | 80 +++++++++++++++++++ 3 files changed, 162 insertions(+), 1 deletion(-) create mode 100644 tests/topologies/1_3_dynamips_missing_type/after/1_3_dynamips.gns3 create mode 100644 tests/topologies/1_3_dynamips_missing_type/before/1_3_dynamips.gns3 diff --git a/gns3server/controller/topology.py b/gns3server/controller/topology.py index d57b3c86..01d915ee 100644 --- a/gns3server/controller/topology.py +++ b/gns3server/controller/topology.py @@ -289,6 +289,10 @@ def _convert_1_3_later(topo, topo_path): node["properties"] = {} + # Some old dynamips node don't have type + if "type" not in old_node: + old_node["type"] = old_node["properties"]["platform"].upper() + if old_node["type"] == "VPCSDevice": node["node_type"] = "vpcs" elif old_node["type"] == "QemuVM": @@ -316,7 +320,7 @@ def _convert_1_3_later(topo, topo_path): node["symbol"] = ":/symbols/ethernet_switch.svg" node["console_type"] = None node["properties"]["ports_mapping"] = [] - for port in old_node["ports"]: + for port in old_node.get("ports", []): node["properties"]["ports_mapping"].append({ "name": "Ethernet{}".format(port["port_number"] - 1), "port_number": port["port_number"] - 1, diff --git a/tests/topologies/1_3_dynamips_missing_type/after/1_3_dynamips.gns3 b/tests/topologies/1_3_dynamips_missing_type/after/1_3_dynamips.gns3 new file mode 100644 index 00000000..eb264324 --- /dev/null +++ b/tests/topologies/1_3_dynamips_missing_type/after/1_3_dynamips.gns3 @@ -0,0 +1,77 @@ +{ + "auto_start": false, + "name": "1_3_dynamips", + "project_id": "ba5790e1-2f51-443e-a3cc-1a2eee132888", + "revision": 6, + "topology": { + "computes": [ + { + "compute_id": "local", + "host": "127.0.0.1", + "name": "Local", + "port": 8000, + "protocol": "http" + } + ], + "drawings": [], + "links": [], + "nodes": [ + { + "symbol": ":/symbols/iosv_virl.svg", + "compute_id": "local", + "console": 2001, + "console_type": "telnet", + "label": { + "rotation": 0, + "style": "font-family: TypeWriter;font-size: 10;font-weight: bold;fill: #000000;fill-opacity: 1.0;", + "text": "R1", + "x": 22, + "y": -25 + }, + "name": "R1", + "node_id": "0bce6ad5-c688-4d4d-a425-f21aaf3927e2", + "node_type": "dynamips", + "port_name_format": "Ethernet{0}", + "port_segment_size": 0, + "first_port_name": null, + "properties": { + "dynamips_id": 1, + "auto_delete_disks": true, + "clock_divisor": 4, + "disk0": 0, + "disk1": 0, + "exec_area": 64, + "idlemax": 500, + "idlesleep": 30, + "image": "c7200-adventerprisek9-mz.124-24.T8.image", + "mac_addr": "ca01.2f39.0000", + "midplane": "vxr", + "mmap": true, + "npe": "npe-400", + "nvram": 512, + "platform": "c7200", + "power_supplies": [ + 1, + 1 + ], + "ram": 512, + "sensors": [ + 22, + 22, + 22, + 22 + ], + "slot0": "C7200-IO-FE", + "sparsemem": true, + "startup_config": "configs/i1_startup-config.cfg", + "system_id": "FTX0945W0MY" + }, + "x": -112, + "y": -100, + "z": 1 + } + ] + }, + "type": "topology", + "version": "ANYSTR" +} diff --git a/tests/topologies/1_3_dynamips_missing_type/before/1_3_dynamips.gns3 b/tests/topologies/1_3_dynamips_missing_type/before/1_3_dynamips.gns3 new file mode 100644 index 00000000..14f2f95d --- /dev/null +++ b/tests/topologies/1_3_dynamips_missing_type/before/1_3_dynamips.gns3 @@ -0,0 +1,80 @@ +{ + "auto_start": false, + "name": "1_3_dynamips", + "project_id": "ba5790e1-2f51-443e-a3cc-1a2eee132888", + "revision": 3, + "topology": { + "nodes": [ + { + "default_symbol": ":/symbols/iosv_virl.normal.svg", + "description": "Router c7200", + "dynamips_id": 1, + "hover_symbol": ":/symbols/iosv_virl.selected.svg", + "id": 1, + "label": { + "color": "#000000", + "font": "TypeWriter,10,-1,5,75,0,0,0,0,0", + "text": "R1", + "x": 22.6171875, + "y": -25.0 + }, + "ports": [ + { + "adapter_number": 0, + "id": 1, + "name": "FastEthernet0/0", + "port_number": 0 + } + ], + "properties": { + "auto_delete_disks": true, + "clock_divisor": 4, + "console": 2001, + "disk0": 0, + "disk1": 0, + "exec_area": 64, + "idlemax": 500, + "idlesleep": 30, + "image": "c7200-adventerprisek9-mz.124-24.T8.image", + "mac_addr": "ca01.2f39.0000", + "midplane": "vxr", + "mmap": true, + "name": "R1", + "npe": "npe-400", + "nvram": 512, + "platform": "c7200", + "power_supplies": [ + 1, + 1 + ], + "ram": 512, + "sensors": [ + 22, + 22, + 22, + 22 + ], + "slot0": "C7200-IO-FE", + "sparsemem": true, + "startup_config": "configs/i1_startup-config.cfg", + "system_id": "FTX0945W0MY" + }, + "server_id": 1, + "vm_id": "0bce6ad5-c688-4d4d-a425-f21aaf3927e2", + "x": -112.0, + "y": -100.0 + } + ], + "servers": [ + { + "cloud": false, + "host": "127.0.0.1", + "id": 1, + "local": true, + "port": 8000 + } + ] + }, + "type": "topology", + "version": "1.3.13" +} From 51d6152a5c18438d13bccb4bc692594d1f448ca3 Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Fri, 19 May 2017 18:27:20 +0200 Subject: [PATCH 03/33] Fix support for some old topologies Fix #1042 --- gns3server/controller/topology.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gns3server/controller/topology.py b/gns3server/controller/topology.py index 01d915ee..13ac5c01 100644 --- a/gns3server/controller/topology.py +++ b/gns3server/controller/topology.py @@ -331,12 +331,12 @@ def _convert_1_3_later(topo, topo_path): node["node_type"] = "frame_relay_switch" node["symbol"] = ":/symbols/frame_relay_switch.svg" node["console_type"] = None - elif old_node["type"] in ["C1700", "C2600", "C2691", "C3600", "C3620", "C3640", "C3660", "C3725", "C3745", "C7200", "EtherSwitchRouter"]: + elif old_node["type"].upper() in ["C1700", "C2600", "C2691", "C3600", "C3620", "C3640", "C3660", "C3725", "C3745", "C7200", "EtherSwitchRouter"]: if node["symbol"] is None: node["symbol"] = ":/symbols/router.svg" node["node_type"] = "dynamips" node["properties"]["dynamips_id"] = old_node.get("dynamips_id") - if "platform" not in node["properties"] and old_node["type"].startswith("C"): + if "platform" not in node["properties"] and old_node["type"].upper().startswith("C"): node["properties"]["platform"] = old_node["type"].lower() if node["properties"]["platform"].startswith("c36"): node["properties"]["platform"] = "c3600" From 4dc55a5af44e6f38a709caa125d6458ef8c43e79 Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Mon, 22 May 2017 13:57:32 +0200 Subject: [PATCH 04/33] Improve logging for remote server connection lost Ref https://github.com/GNS3/gns3-gui/issues/2074 --- gns3server/controller/compute.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gns3server/controller/compute.py b/gns3server/controller/compute.py index 6a4ac0ce..986320fc 100644 --- a/gns3server/controller/compute.py +++ b/gns3server/controller/compute.py @@ -580,8 +580,10 @@ class Compute: Forward a call to the emulator on compute """ try: - res = yield from self.http_query(method, "/{}/{}".format(type, path), data=data, timeout=None) + action = "/{}/{}".format(type, path) + res = yield from self.http_query(method, action, data=data, timeout=None) except aiohttp.errors.DisconnectedError: + log.error("Connection lost to %s during %s %s", self._id, method, action) raise aiohttp.web.HTTPGatewayTimeout() return res.json From 7d30da5d4ee54844590dbd18e8350c754435194c Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Mon, 22 May 2017 20:18:07 +0200 Subject: [PATCH 05/33] Do not wait auto start to finish in order to complete project opening Fix https://github.com/GNS3/gns3-gui/issues/2074 --- gns3server/controller/project.py | 5 ++++- tests/utils.py | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gns3server/controller/project.py b/gns3server/controller/project.py index c71ce360..3cf17af8 100644 --- a/gns3server/controller/project.py +++ b/gns3server/controller/project.py @@ -675,7 +675,10 @@ class Project: self._loading = False # Should we start the nodes when project is open if self._auto_start: - yield from self.start_all() + # Start all in the background without waiting for completion + # we ignore errors because we want to let the user open + # their project and fix it + asyncio.async(self.start_all()) @asyncio.coroutine def wait_loaded(self): diff --git a/tests/utils.py b/tests/utils.py index 3c638d52..a818462a 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -18,6 +18,7 @@ import io import asyncio import unittest.mock +import collections.abc class _asyncio_patch: @@ -69,6 +70,7 @@ class AsyncioMagicMock(unittest.mock.MagicMock): """ Magic mock returning coroutine """ + __class__ = collections.abc.Awaitable def __init__(self, return_value=None, return_values=None, **kwargs): """ From 3ed49bbdd564ea0b75309645537cb2ce5dd59651 Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Tue, 23 May 2017 08:29:36 +0200 Subject: [PATCH 06/33] Update pytest from 3.0.7 to 3.1.0 (#1044) --- dev-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index f0f87d96..8759f431 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,7 +1,7 @@ -rrequirements.txt sphinx==1.6.1 -pytest==3.0.7 +pytest==3.1.0 pep8==1.7.0 pytest-catchlog==1.2.2 pytest-timeout==1.2.0 From 2191c487b6eb7f4c65a423511e5cac4e785de3f1 Mon Sep 17 00:00:00 2001 From: Bernhard Ehlers Date: Fri, 19 May 2017 13:28:32 +0200 Subject: [PATCH 07/33] Support images created by "docker commit". Fixes #1039 --- gns3server/compute/docker/docker_vm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gns3server/compute/docker/docker_vm.py b/gns3server/compute/docker/docker_vm.py index 00e9a72a..bc88fc8b 100644 --- a/gns3server/compute/docker/docker_vm.py +++ b/gns3server/compute/docker/docker_vm.py @@ -213,7 +213,7 @@ class DockerVM(BaseNode): self._volumes = ["/etc/network"] - volumes = image_infos.get("ContainerConfig", {}).get("Volumes") + volumes = image_infos.get("Config", {}).get("Volumes") if volumes is None: return binds for volume in volumes.keys(): From 1e598d1890031a39347d30bbeda29702edebc0f9 Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Tue, 23 May 2017 10:18:30 +0200 Subject: [PATCH 08/33] Test for support of docker commit images Ref #1039 --- tests/compute/docker/test_docker_vm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/compute/docker/test_docker_vm.py b/tests/compute/docker/test_docker_vm.py index 3d28f11a..6ca6fd14 100644 --- a/tests/compute/docker/test_docker_vm.py +++ b/tests/compute/docker/test_docker_vm.py @@ -840,7 +840,7 @@ def test_get_image_informations(project, manager, loop): @pytest.mark.skipif(sys.platform.startswith("win"), reason="Not supported on Windows") def test_mount_binds(vm, tmpdir): image_infos = { - "ContainerConfig": { + "Config": { "Volumes": { "/test/experimental": {} } From 7d48eba01b3a929b2b1b261dccead62bbf9c1d95 Mon Sep 17 00:00:00 2001 From: Bernhard Ehlers Date: Tue, 2 May 2017 10:37:29 +0200 Subject: [PATCH 09/33] Use versioned docker API Since docker v1.13 the unversioned docker API is deprecated. Backport of gns3-server 2.0, commit effbe59 --- gns3server/compute/docker/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gns3server/compute/docker/__init__.py b/gns3server/compute/docker/__init__.py index 7b3e4d96..460472c3 100644 --- a/gns3server/compute/docker/__init__.py +++ b/gns3server/compute/docker/__init__.py @@ -113,11 +113,13 @@ class Docker(BaseManager): :returns: HTTP response """ data = json.dumps(data) - url = "http://docker/v" + DOCKER_MINIMUM_API_VERSION + "/" + path - if timeout is None: timeout = 60 * 60 * 24 * 31 # One month timeout + if path == 'version': + url = "http://docker/v1.12/" + path # API of docker v1.0 + else: + url = "http://docker/v" + DOCKER_MINIMUM_API_VERSION + "/" + path try: if path != "version": # version is use by check connection yield from self._check_connection() From 8b7209ea78dca26e40fae658dc408591c68171a2 Mon Sep 17 00:00:00 2001 From: Bernhard Ehlers Date: Tue, 16 May 2017 12:36:38 +0200 Subject: [PATCH 10/33] Use docker version in error message of outdated docker installation --- gns3server/compute/docker/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gns3server/compute/docker/__init__.py b/gns3server/compute/docker/__init__.py index 460472c3..b8038152 100644 --- a/gns3server/compute/docker/__init__.py +++ b/gns3server/compute/docker/__init__.py @@ -34,6 +34,7 @@ log = logging.getLogger(__name__) DOCKER_MINIMUM_API_VERSION = "1.25" +DOCKER_MINIMUM_VERSION = "1.9" class Docker(BaseManager): @@ -60,7 +61,7 @@ class Docker(BaseManager): self._connected = False raise DockerError("Can't connect to docker daemon") if parse_version(version["ApiVersion"]) < parse_version(DOCKER_MINIMUM_API_VERSION): - raise DockerError("Docker API version is {}. GNS3 requires a minimum API version of {}".format(version["ApiVersion"], DOCKER_MINIMUM_API_VERSION)) + raise DockerError("Docker version is {}. GNS3 requires a minimum version of {}".format(version["Version"], DOCKER_MINIMUM_VERSION)) def connector(self): if self._connector is None or self._connector.closed: From 2a8911d19e2214529d4821f06aa8a7aa5bed5221 Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Tue, 23 May 2017 11:00:15 +0200 Subject: [PATCH 11/33] Keep DOCKER_MINIMUM_API_VERSION and DOCKER_MINIMUM_VERSION consistent --- gns3server/compute/docker/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gns3server/compute/docker/__init__.py b/gns3server/compute/docker/__init__.py index b8038152..18ad331f 100644 --- a/gns3server/compute/docker/__init__.py +++ b/gns3server/compute/docker/__init__.py @@ -33,8 +33,9 @@ from gns3server.compute.docker.docker_error import DockerError, DockerHttp304Err log = logging.getLogger(__name__) +# Be carefull to keep it consistent DOCKER_MINIMUM_API_VERSION = "1.25" -DOCKER_MINIMUM_VERSION = "1.9" +DOCKER_MINIMUM_VERSION = "1.13" class Docker(BaseManager): From 54e80d68f89849385e2eb748c4d2673fd0271d9d Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Tue, 23 May 2017 11:11:13 +0200 Subject: [PATCH 12/33] Fix test failed on Python 3.4 Fix #1045 --- tests/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/utils.py b/tests/utils.py index a818462a..abd3f0e3 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -16,9 +16,9 @@ # along with this program. If not, see . import io +import types import asyncio import unittest.mock -import collections.abc class _asyncio_patch: @@ -70,7 +70,7 @@ class AsyncioMagicMock(unittest.mock.MagicMock): """ Magic mock returning coroutine """ - __class__ = collections.abc.Awaitable + __class__ = types.CoroutineType def __init__(self, return_value=None, return_values=None, **kwargs): """ From 59488e8064f82e7b04f6258ff163e231a7f5fc03 Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Tue, 23 May 2017 12:15:04 +0200 Subject: [PATCH 13/33] Fix tests on python 3.4 (#1046) --- gns3server/controller/gns3vm/__init__.py | 2 +- tests/utils.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/gns3server/controller/gns3vm/__init__.py b/gns3server/controller/gns3vm/__init__.py index bace3022..8c8cd4a7 100644 --- a/gns3server/controller/gns3vm/__init__.py +++ b/gns3server/controller/gns3vm/__init__.py @@ -287,7 +287,7 @@ class GNS3VM: yield from engine.start() except Exception as e: yield from self._controller.delete_compute("vm") - log.error("Can't start the GNS3 VM: {}", str(e)) + log.error("Can't start the GNS3 VM: {}".format(str(e))) yield from compute.update(name="GNS3 VM ({})".format(engine.vmname)) raise e yield from compute.update(name="GNS3 VM ({})".format(engine.vmname), diff --git a/tests/utils.py b/tests/utils.py index abd3f0e3..f1cfd191 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -70,7 +70,10 @@ class AsyncioMagicMock(unittest.mock.MagicMock): """ Magic mock returning coroutine """ - __class__ = types.CoroutineType + try: + __class__ = types.CoroutineType + except AttributeError: # Not supported with Python 3.4 + __class__ = types.GeneratorType def __init__(self, return_value=None, return_values=None, **kwargs): """ From 5bb6c51698fbdb6e93fbe36bef648165db87f2b9 Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Tue, 23 May 2017 13:31:04 +0200 Subject: [PATCH 14/33] Fix an error when logging Docker container fail to start --- gns3server/compute/docker/docker_vm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gns3server/compute/docker/docker_vm.py b/gns3server/compute/docker/docker_vm.py index bc88fc8b..f384d5aa 100644 --- a/gns3server/compute/docker/docker_vm.py +++ b/gns3server/compute/docker/docker_vm.py @@ -361,7 +361,7 @@ class DockerVM(BaseNode): try: yield from self._add_ubridge_connection(nio, adapter_number) except UbridgeNamespaceError: - log.error("Container {} failed to start", self.name) + log.error("Container %s failed to start", self.name) yield from self.stop() # The container can crash soon after the start, this means we can not move the interface to the container namespace From d765d02f063c0e6d27b614bf138d9d0b030f2440 Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Tue, 23 May 2017 13:39:41 +0200 Subject: [PATCH 15/33] Fix error in logging of error during starting GNS3 VM --- gns3server/controller/gns3vm/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gns3server/controller/gns3vm/__init__.py b/gns3server/controller/gns3vm/__init__.py index 8c8cd4a7..a24ae702 100644 --- a/gns3server/controller/gns3vm/__init__.py +++ b/gns3server/controller/gns3vm/__init__.py @@ -250,7 +250,7 @@ class GNS3VM: force=True) except aiohttp.web.HTTPConflict: pass - log.error("Can't start the GNS3 VM: {}", str(e)) + log.error("Can't start the GNS3 VM: %s", str(e)) @asyncio.coroutine def exit_vm(self): From b87692acce5f8c100a77afe3e4cfb8f0a836f8d8 Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Tue, 23 May 2017 14:05:47 +0200 Subject: [PATCH 16/33] Fix import of some old topologies from 1.3 --- gns3server/schemas/dynamips_vm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gns3server/schemas/dynamips_vm.py b/gns3server/schemas/dynamips_vm.py index 8cb03c9b..f91712ad 100644 --- a/gns3server/schemas/dynamips_vm.py +++ b/gns3server/schemas/dynamips_vm.py @@ -33,7 +33,7 @@ VM_CREATE_SCHEMA = { }, "dynamips_id": { "description": "Dynamips ID", - "type": "integer" + "type": ["integer", "null"] }, "name": { "description": "Dynamips VM instance name", From 5a86277a9f20e35e7851a4c847802fa4b911dfee Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Tue, 23 May 2017 16:08:30 +0200 Subject: [PATCH 17/33] Test that import erase the auto_open and auto_start setting Ref #1041 --- tests/controller/test_import_project.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/controller/test_import_project.py b/tests/controller/test_import_project.py index e61e1ed8..7e03ea28 100644 --- a/tests/controller/test_import_project.py +++ b/tests/controller/test_import_project.py @@ -35,6 +35,8 @@ def test_import_project(async_run, tmpdir, controller): topology = { "project_id": str(uuid.uuid4()), "name": "test", + "auto_open": True, + "auto_start": True, "topology": { }, "version": "2.0.0" @@ -67,6 +69,8 @@ def test_import_project(async_run, tmpdir, controller): # A new project name is generated when you import twice the same name with open(zip_path, "rb") as f: project = async_run(import_project(controller, str(uuid.uuid4()), f)) + assert project.auto_open is False + assert project.auto_start is False assert project.name != "test" From 39879ca92b4a41ef91cd36c7f837ddfd4bbeb63d Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Tue, 23 May 2017 17:20:51 +0200 Subject: [PATCH 18/33] Duplicate project on remote server use UUID Ref https://github.com/GNS3/gns3-server/issues/1040 --- gns3server/controller/import_project.py | 3 +-- gns3server/handlers/api/controller/project_handler.py | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/gns3server/controller/import_project.py b/gns3server/controller/import_project.py index 0bdccc1d..d3cb6f00 100644 --- a/gns3server/controller/import_project.py +++ b/gns3server/controller/import_project.py @@ -24,7 +24,6 @@ import asyncio import zipfile import aiohttp -from ..config import Config from .topology import load_topology @@ -74,7 +73,7 @@ def import_project(controller, project_id, stream, location=None, name=None, kee path = location else: projects_path = controller.projects_directory() - path = os.path.join(projects_path, project_name) + path = os.path.join(projects_path, project_id) try: os.makedirs(path, exist_ok=True) except UnicodeEncodeError as e: diff --git a/gns3server/handlers/api/controller/project_handler.py b/gns3server/handlers/api/controller/project_handler.py index 92827a87..232147f6 100644 --- a/gns3server/handlers/api/controller/project_handler.py +++ b/gns3server/handlers/api/controller/project_handler.py @@ -23,7 +23,6 @@ import tempfile from gns3server.web.route import Route from gns3server.controller import Controller -from gns3server.controller.project import Project from gns3server.controller.import_project import import_project from gns3server.controller.export_project import export_project from gns3server.config import Config From c3d5abd10475fd44aab90e93b477925ac70365c2 Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Fri, 26 May 2017 10:29:33 +0200 Subject: [PATCH 19/33] Remote install script should be totally non interactive --- scripts/remote-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/remote-install.sh b/scripts/remote-install.sh index 260c8d8d..d486291a 100644 --- a/scripts/remote-install.sh +++ b/scripts/remote-install.sh @@ -152,7 +152,7 @@ log "Update system packages" apt-get update log "Upgrade packages" -apt-get upgrade -y +apt-get upgrade --yes --force-yes -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" log " Install GNS3 packages" apt-get install -y gns3-server From 8bbe7e80411a3794a9491047d5da408e32bf067c Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Fri, 26 May 2017 10:47:25 +0200 Subject: [PATCH 20/33] Set correct permission on ubridge when doing a remote installation --- scripts/remote-install.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/remote-install.sh b/scripts/remote-install.sh index d486291a..8e9c741e 100644 --- a/scripts/remote-install.sh +++ b/scripts/remote-install.sh @@ -163,6 +163,10 @@ then useradd -d /opt/gns3/ -m gns3 fi + +log "Add GNS3 to the ubridge group" +usermod -aG ubridge gns3 + log "Install docker" if [ ! -f "/usr/bin/docker" ] then From c46a9da76939a20c4fffece4e5d42f456dc49a9e Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Mon, 29 May 2017 09:01:12 +0200 Subject: [PATCH 21/33] Update sphinx from 1.6.1 to 1.6.2 (#1049) --- dev-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index 8759f431..8bd17213 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,6 +1,6 @@ -rrequirements.txt -sphinx==1.6.1 +sphinx==1.6.2 pytest==3.1.0 pep8==1.7.0 pytest-catchlog==1.2.2 From 78e1321bae30cc1a404647894b1819d7e1f180d3 Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Tue, 30 May 2017 08:56:50 +0200 Subject: [PATCH 22/33] 2.0.2 --- CHANGELOG | 13 +++++++++++++ gns3server/crash_report.py | 2 +- gns3server/version.py | 4 ++-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 477dd91a..8ea402eb 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,18 @@ # Change Log +## 2.0.2 30/05/2017 + +* Set correct permission on ubridge when doing a remote installation +* Remote install script should be totally non interactive +* Duplicate project on remote server use UUID +* Fix import of some old topologies from 1.3 +* Fix error in logging of error during starting GNS3 VM +* Fix an error when logging Docker container fail to start +* Use docker version in error message of outdated docker installation +* Support images created by "docker commit". Fixes #1039 +* Do not wait auto start to finish in order to complete project opening +* Improve logging for remote server connection lost + ## 2.0.1 16/05/2017 * Handle HTTP 504 errors from compute node diff --git a/gns3server/crash_report.py b/gns3server/crash_report.py index 0b600e71..77ae01f4 100644 --- a/gns3server/crash_report.py +++ b/gns3server/crash_report.py @@ -54,7 +54,7 @@ class CrashReport: Report crash to a third party service """ - DSN = "sync+https://9b1156a90ee943eba20e032cf007297d:024b75c7b11844a58df147a4fb059774@sentry.io/38482" + DSN = "sync+https://67b93949a78d4ef5978388cc4b8906f9:271ee1dd01db4a39b919097f452cb6c5@sentry.io/38482" if hasattr(sys, "frozen"): cacert = get_resource("cacert.pem") if cacert is not None and os.path.isfile(cacert): diff --git a/gns3server/version.py b/gns3server/version.py index 3e3497d0..cba547bc 100644 --- a/gns3server/version.py +++ b/gns3server/version.py @@ -23,7 +23,7 @@ # or negative for a release candidate or beta (after the base version # number has been incremented) -__version__ = "2.0.2dev1" +__version__ = "2.0.2" # If it's a git checkout try to add the commit if "dev" in __version__: @@ -36,4 +36,4 @@ if "dev" in __version__: except Exception as e: print(e) -__version_info__ = (2, 0, 2, -99) +__version_info__ = (2, 0, 2, 0) From 7913646ce3e7c0ffbcba32a879debd0406fedb8a Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Tue, 30 May 2017 08:58:05 +0200 Subject: [PATCH 23/33] 2.0.3dev1 --- gns3server/version.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gns3server/version.py b/gns3server/version.py index cba547bc..a5999586 100644 --- a/gns3server/version.py +++ b/gns3server/version.py @@ -23,7 +23,7 @@ # or negative for a release candidate or beta (after the base version # number has been incremented) -__version__ = "2.0.2" +__version__ = "2.0.3dev1" # If it's a git checkout try to add the commit if "dev" in __version__: @@ -36,4 +36,4 @@ if "dev" in __version__: except Exception as e: print(e) -__version_info__ = (2, 0, 2, 0) +__version_info__ = (2, 0, 3, -99) From 07049562a41a4350c8566c3c13081290c4d45754 Mon Sep 17 00:00:00 2001 From: "pyup.io bot" Date: Wed, 31 May 2017 15:34:36 +0200 Subject: [PATCH 24/33] Update pytest from 3.1.0 to 3.1.1 (#1056) --- dev-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index 8bd17213..51e2d6b5 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,7 +1,7 @@ -rrequirements.txt sphinx==1.6.2 -pytest==3.1.0 +pytest==3.1.1 pep8==1.7.0 pytest-catchlog==1.2.2 pytest-timeout==1.2.0 From 6fa27c68853106dc9c76c2effacef8a1be7caf3c Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Wed, 31 May 2017 16:56:28 +0200 Subject: [PATCH 25/33] Check aiohttp version --- gns3server/web/web_server.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gns3server/web/web_server.py b/gns3server/web/web_server.py index 0bcc71a5..af65496e 100644 --- a/gns3server/web/web_server.py +++ b/gns3server/web/web_server.py @@ -43,6 +43,9 @@ import gns3server.handlers import logging log = logging.getLogger(__name__) +if not aiohttp.__version__.startswith("1.3"): + raise RuntimeError("You need aiohttp 13 for running GNS3") + class WebServer: From e74e66b20363766c60cd46e044005a06cb340393 Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Wed, 31 May 2017 17:04:14 +0200 Subject: [PATCH 26/33] Typo in error message --- gns3server/web/web_server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gns3server/web/web_server.py b/gns3server/web/web_server.py index af65496e..8e565cd8 100644 --- a/gns3server/web/web_server.py +++ b/gns3server/web/web_server.py @@ -44,7 +44,7 @@ import logging log = logging.getLogger(__name__) if not aiohttp.__version__.startswith("1.3"): - raise RuntimeError("You need aiohttp 13 for running GNS3") + raise RuntimeError("You need aiohttp 1.3 for running GNS3") class WebServer: From 823288dd0b78535f3f9e9fb533fc982656e346bb Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Thu, 1 Jun 2017 18:35:03 +0200 Subject: [PATCH 27/33] Fix a crash in some cases --- gns3server/web/response.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gns3server/web/response.py b/gns3server/web/response.py index c394d305..13c97742 100644 --- a/gns3server/web/response.py +++ b/gns3server/web/response.py @@ -46,7 +46,8 @@ class Response(aiohttp.web.Response): def enable_chunked_encoding(self): # Very important: do not send a content length otherwise QT closes the connection (curl can consume the feed) - self.content_length = None + if self.content_length: + self.content_length = None super().enable_chunked_encoding() @asyncio.coroutine From 7dfb634376b5439cc9b1598905b222e85191f130 Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Thu, 1 Jun 2017 18:39:55 +0200 Subject: [PATCH 28/33] Fix for websocket usage with aiohttp 2.0 Fix #1050 --- gns3server/compute/docker/__init__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gns3server/compute/docker/__init__.py b/gns3server/compute/docker/__init__.py index 37506393..72a8b692 100644 --- a/gns3server/compute/docker/__init__.py +++ b/gns3server/compute/docker/__init__.py @@ -166,10 +166,10 @@ class Docker(BaseManager): """ url = "http://docker/v" + DOCKER_MINIMUM_API_VERSION + "/" + path - connection = yield from aiohttp.ws_connect(url, - connector=self.connector(), - origin="http://docker", - autoping=True) + connection = yield from self._session.ws_connect(url, + connector=self.connector(), + origin="http://docker", + autoping=True) return connection @locked_coroutine From 6a0345897d7652f9569ce09ccd0b84cfd0750832 Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Fri, 2 Jun 2017 10:42:40 +0200 Subject: [PATCH 29/33] Connector is no longer supported in ws_connect by aiohttp 2.0 --- gns3server/compute/docker/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/gns3server/compute/docker/__init__.py b/gns3server/compute/docker/__init__.py index 72a8b692..7e3ccd69 100644 --- a/gns3server/compute/docker/__init__.py +++ b/gns3server/compute/docker/__init__.py @@ -167,7 +167,6 @@ class Docker(BaseManager): url = "http://docker/v" + DOCKER_MINIMUM_API_VERSION + "/" + path connection = yield from self._session.ws_connect(url, - connector=self.connector(), origin="http://docker", autoping=True) return connection From 2fe589b1a881f5eaef9bbf142ca80bb3eb073dbc Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Tue, 6 Jun 2017 16:07:27 +0200 Subject: [PATCH 30/33] Fix invalid test for 1.3 topology conversion to GNS3 2.1 --- .../topologies/1_3_dynamips_missing_type/after/1_3_dynamips.gns3 | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/topologies/1_3_dynamips_missing_type/after/1_3_dynamips.gns3 b/tests/topologies/1_3_dynamips_missing_type/after/1_3_dynamips.gns3 index eb264324..30326e4e 100644 --- a/tests/topologies/1_3_dynamips_missing_type/after/1_3_dynamips.gns3 +++ b/tests/topologies/1_3_dynamips_missing_type/after/1_3_dynamips.gns3 @@ -63,7 +63,6 @@ ], "slot0": "C7200-IO-FE", "sparsemem": true, - "startup_config": "configs/i1_startup-config.cfg", "system_id": "FTX0945W0MY" }, "x": -112, From cdcdba74115b190d93eb0dc49f8f10f1424e55bb Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Tue, 6 Jun 2017 16:27:21 +0200 Subject: [PATCH 31/33] Fix installation issue with Python 3.4 and aiohttp cors --- .travis.yml | 1 + tests/conftest.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 7567504d..b27dd814 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,7 @@ python: sudo: false cache: pip install: +- pip install -U setuptools pip - python setup.py install - pip install -rdev-requirements.txt script: diff --git a/tests/conftest.py b/tests/conftest.py index 2ecd7764..1f20880c 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -15,7 +15,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . - +import gc import pytest import socket import asyncio @@ -228,6 +228,7 @@ def run_around_tests(monkeypatch, port_manager, controller, config): shutil.rmtree(tmppath) except: pass + gc.collect() @pytest.fixture From c538ec5937ce402eac3fd79cb0a153266001936f Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Wed, 7 Jun 2017 11:20:55 +0200 Subject: [PATCH 32/33] Fix tests on case sensitive file system --- tests/controller/test_export_project.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/controller/test_export_project.py b/tests/controller/test_export_project.py index f48df7c8..81586dc2 100644 --- a/tests/controller/test_export_project.py +++ b/tests/controller/test_export_project.py @@ -27,13 +27,12 @@ from unittest.mock import MagicMock from tests.utils import AsyncioMagicMock, AsyncioBytesIO from gns3server.controller.project import Project -from gns3server.controller.compute import Compute from gns3server.controller.export_project import export_project, _filter_files @pytest.fixture def project(controller): - p = Project(controller=controller, name="Test") + p = Project(controller=controller, name="test") p.dump = MagicMock() return p @@ -179,7 +178,7 @@ def test_export_disallow_running(tmpdir, project, node, async_run): node._status = "started" with pytest.raises(aiohttp.web.HTTPConflict): - z = async_run(export_project(project, str(tmpdir))) + async_run(export_project(project, str(tmpdir))) def test_export_disallow_some_type(tmpdir, project, async_run): From b9e2b7945a803e8452e1cc8b0fe7081bcbc3ee2d Mon Sep 17 00:00:00 2001 From: ziajka Date: Wed, 7 Jun 2017 14:39:47 +0200 Subject: [PATCH 33/33] Removed gc collection at testing --- tests/conftest.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index 1f20880c..3308e5b1 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -228,7 +228,6 @@ def run_around_tests(monkeypatch, port_manager, controller, config): shutil.rmtree(tmppath) except: pass - gc.collect() @pytest.fixture