diff --git a/gns3server/controller/__init__.py b/gns3server/controller/__init__.py index 611755c4..59ed9712 100644 --- a/gns3server/controller/__init__.py +++ b/gns3server/controller/__init__.py @@ -82,7 +82,7 @@ class Controller: password=server_config.get("password", ""), force=True) except aiohttp.web_exceptions.HTTPConflict as e: - log.fatal("Can't acces to the local server, make sure anything else is not running on the same port") + log.fatal("Can't access to the local server, make sure anything else is not running on the same port") sys.exit(1) for c in computes: try: @@ -176,7 +176,7 @@ class Controller: if "gns3vm" in data: self.gns3vm.settings = data["gns3vm"] - return data["computes"] + return data.get("computes", []) @asyncio.coroutine def load_projects(self): diff --git a/tests/controller/test_controller.py b/tests/controller/test_controller.py index f31fa999..e240c5b4 100644 --- a/tests/controller/test_controller.py +++ b/tests/controller/test_controller.py @@ -65,6 +65,16 @@ def test_load_controller_settings(controller, controller_config_path, async_run) assert controller.gns3vm.settings["vmname"] == "Test VM" +def test_load_controller_settings_with_no_computes_section(controller, controller_config_path, async_run): + controller.save() + with open(controller_config_path) as f: + data = json.load(f) + del data['computes'] + with open(controller_config_path, "w+") as f: + json.dump(data, f) + assert len(async_run(controller._load_controller_settings())) == 0 + + def test_import_computes_1_x(controller, controller_config_path, async_run): """ At first start the server should import the