mirror of
https://github.com/GNS3/gns3-server.git
synced 2024-12-30 09:38:53 +00:00
You can't modify startup script remotely
This commit is contained in:
parent
0ce344b1d2
commit
f572f3fc95
@ -47,7 +47,6 @@ class VPCSHandler:
|
|||||||
request.json["project_uuid"],
|
request.json["project_uuid"],
|
||||||
request.json.get("uuid"),
|
request.json.get("uuid"),
|
||||||
console=request.json.get("console"),
|
console=request.json.get("console"),
|
||||||
script_file=request.json.get("script_file"),
|
|
||||||
startup_script=request.json.get("startup_script"))
|
startup_script=request.json.get("startup_script"))
|
||||||
response.set_status(201)
|
response.set_status(201)
|
||||||
response.json(vm)
|
response.json(vm)
|
||||||
@ -90,7 +89,6 @@ class VPCSHandler:
|
|||||||
vm = vpcs_manager.get_vm(request.match_info["uuid"])
|
vm = vpcs_manager.get_vm(request.match_info["uuid"])
|
||||||
vm.name = request.json.get("name", vm.name)
|
vm.name = request.json.get("name", vm.name)
|
||||||
vm.console = request.json.get("console", vm.console)
|
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)
|
vm.startup_script = request.json.get("startup_script", vm.startup_script)
|
||||||
response.json(vm)
|
response.json(vm)
|
||||||
|
|
||||||
|
@ -50,10 +50,6 @@ VPCS_CREATE_SCHEMA = {
|
|||||||
"maximum": 65535,
|
"maximum": 65535,
|
||||||
"type": ["integer", "null"]
|
"type": ["integer", "null"]
|
||||||
},
|
},
|
||||||
"script_file": {
|
|
||||||
"description": "VPCS startup script",
|
|
||||||
"type": ["string", "null"]
|
|
||||||
},
|
|
||||||
"startup_script": {
|
"startup_script": {
|
||||||
"description": "Content of the VPCS startup script",
|
"description": "Content of the VPCS startup script",
|
||||||
"type": ["string", "null"]
|
"type": ["string", "null"]
|
||||||
@ -79,10 +75,6 @@ VPCS_UPDATE_SCHEMA = {
|
|||||||
"maximum": 65535,
|
"maximum": 65535,
|
||||||
"type": ["integer", "null"]
|
"type": ["integer", "null"]
|
||||||
},
|
},
|
||||||
"script_file": {
|
|
||||||
"description": "VPCS startup script",
|
|
||||||
"type": ["string", "null"]
|
|
||||||
},
|
|
||||||
"startup_script": {
|
"startup_script": {
|
||||||
"description": "Content of the VPCS startup script",
|
"description": "Content of the VPCS startup script",
|
||||||
"type": ["string", "null"]
|
"type": ["string", "null"]
|
||||||
|
@ -45,18 +45,6 @@ def test_vpcs_get(server, project, vm):
|
|||||||
assert response.json["project_uuid"] == project.uuid
|
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):
|
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"})
|
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
|
assert response.status == 201
|
||||||
@ -134,15 +122,10 @@ def test_vpcs_delete(server, vm):
|
|||||||
|
|
||||||
|
|
||||||
def test_vpcs_update(server, vm, tmpdir, free_console_port):
|
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",
|
response = server.put("/vpcs/{}".format(vm["uuid"]), {"name": "test",
|
||||||
"console": free_console_port,
|
"console": free_console_port,
|
||||||
"script_file": path,
|
|
||||||
"startup_script": "ip 192.168.1.1"})
|
"startup_script": "ip 192.168.1.1"})
|
||||||
assert response.status == 200
|
assert response.status == 200
|
||||||
assert response.json["name"] == "test"
|
assert response.json["name"] == "test"
|
||||||
assert response.json["console"] == free_console_port
|
assert response.json["console"] == free_console_port
|
||||||
assert response.json["script_file"] == path
|
|
||||||
assert response.json["startup_script"] == "ip 192.168.1.1"
|
assert response.json["startup_script"] == "ip 192.168.1.1"
|
||||||
|
Loading…
Reference in New Issue
Block a user