From f572f3fc95590e350c0cc6a7864d5a60eac3b405 Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Tue, 3 Feb 2015 20:28:31 +0100 Subject: [PATCH] You can't modify startup script remotely --- gns3server/handlers/vpcs_handler.py | 2 -- gns3server/schemas/vpcs.py | 8 -------- tests/api/test_vpcs.py | 17 ----------------- 3 files changed, 27 deletions(-) diff --git a/gns3server/handlers/vpcs_handler.py b/gns3server/handlers/vpcs_handler.py index 060ee587..a63f475a 100644 --- a/gns3server/handlers/vpcs_handler.py +++ b/gns3server/handlers/vpcs_handler.py @@ -47,7 +47,6 @@ class VPCSHandler: request.json["project_uuid"], request.json.get("uuid"), console=request.json.get("console"), - script_file=request.json.get("script_file"), startup_script=request.json.get("startup_script")) response.set_status(201) response.json(vm) @@ -90,7 +89,6 @@ class VPCSHandler: vm = vpcs_manager.get_vm(request.match_info["uuid"]) vm.name = request.json.get("name", vm.name) vm.console = request.json.get("console", vm.console) - vm.script_file = request.json.get("script_file", vm.script_file) vm.startup_script = request.json.get("startup_script", vm.startup_script) response.json(vm) diff --git a/gns3server/schemas/vpcs.py b/gns3server/schemas/vpcs.py index e4dae510..b4841034 100644 --- a/gns3server/schemas/vpcs.py +++ b/gns3server/schemas/vpcs.py @@ -50,10 +50,6 @@ VPCS_CREATE_SCHEMA = { "maximum": 65535, "type": ["integer", "null"] }, - "script_file": { - "description": "VPCS startup script", - "type": ["string", "null"] - }, "startup_script": { "description": "Content of the VPCS startup script", "type": ["string", "null"] @@ -79,10 +75,6 @@ VPCS_UPDATE_SCHEMA = { "maximum": 65535, "type": ["integer", "null"] }, - "script_file": { - "description": "VPCS startup script", - "type": ["string", "null"] - }, "startup_script": { "description": "Content of the VPCS startup script", "type": ["string", "null"] diff --git a/tests/api/test_vpcs.py b/tests/api/test_vpcs.py index db318494..56c970a2 100644 --- a/tests/api/test_vpcs.py +++ b/tests/api/test_vpcs.py @@ -45,18 +45,6 @@ def test_vpcs_get(server, project, vm): assert response.json["project_uuid"] == project.uuid -def test_vpcs_create_script_file(server, project, tmpdir): - path = os.path.join(str(tmpdir), "test") - with open(path, 'w+') as f: - f.write("ip 192.168.1.2") - response = server.post("/vpcs", {"name": "PC TEST 1", "project_uuid": project.uuid, "script_file": path}) - assert response.status == 201 - assert response.route == "/vpcs" - assert response.json["name"] == "PC TEST 1" - assert response.json["project_uuid"] == project.uuid - assert response.json["script_file"] == path - - def test_vpcs_create_startup_script(server, project): response = server.post("/vpcs", {"name": "PC TEST 1", "project_uuid": project.uuid, "startup_script": "ip 192.168.1.2\necho TEST"}) assert response.status == 201 @@ -134,15 +122,10 @@ def test_vpcs_delete(server, vm): def test_vpcs_update(server, vm, tmpdir, free_console_port): - path = os.path.join(str(tmpdir), 'startup2.vpcs') - with open(path, 'w+') as f: - f.write(path) response = server.put("/vpcs/{}".format(vm["uuid"]), {"name": "test", "console": free_console_port, - "script_file": path, "startup_script": "ip 192.168.1.1"}) assert response.status == 200 assert response.json["name"] == "test" assert response.json["console"] == free_console_port - assert response.json["script_file"] == path assert response.json["startup_script"] == "ip 192.168.1.1"