mirror of
https://github.com/GNS3/gns3-server
synced 2025-01-11 08:30:57 +00:00
Support all characters for compute ID
This commit is contained in:
parent
b46a0ff4ae
commit
d43e78a1d7
@ -60,20 +60,6 @@ class ComputeHandler:
|
||||
controller = Controller.instance()
|
||||
response.json([c for c in controller.computes.values()])
|
||||
|
||||
@classmethod
|
||||
@Route.get(
|
||||
r"/computes/{compute_id}",
|
||||
description="Get a compute node informations",
|
||||
status_codes={
|
||||
200: "Compute list"
|
||||
},
|
||||
output=COMPUTE_OBJECT_SCHEMA)
|
||||
def get(request, response):
|
||||
|
||||
controller = Controller.instance()
|
||||
compute = controller.get_compute(request.match_info["compute_id"])
|
||||
response.json(compute)
|
||||
|
||||
@classmethod
|
||||
@Route.post(
|
||||
r"/computes/shutdown",
|
||||
@ -110,3 +96,17 @@ class ComputeHandler:
|
||||
server = WebServer.instance()
|
||||
asyncio.async(server.shutdown_server())
|
||||
response.set_status(201)
|
||||
|
||||
@classmethod
|
||||
@Route.get(
|
||||
r"/computes/{compute_id:.+}",
|
||||
description="Get a compute node informations",
|
||||
status_codes={
|
||||
200: "Compute list"
|
||||
},
|
||||
output=COMPUTE_OBJECT_SCHEMA)
|
||||
def get(request, response):
|
||||
|
||||
controller = Controller.instance()
|
||||
compute = controller.get_compute(request.match_info["compute_id"])
|
||||
response.json(compute)
|
||||
|
@ -39,7 +39,7 @@ def test_compute_create(http_controller, controller):
|
||||
def test_compute_get(http_controller, controller):
|
||||
|
||||
params = {
|
||||
"compute_id": "my_compute_id",
|
||||
"compute_id": "my_compute/id",
|
||||
"protocol": "http",
|
||||
"host": "example.com",
|
||||
"port": 84,
|
||||
@ -49,7 +49,7 @@ def test_compute_get(http_controller, controller):
|
||||
response = http_controller.post("/computes", params)
|
||||
assert response.status == 201
|
||||
|
||||
response = http_controller.get("/computes/my_compute_id", example=True)
|
||||
response = http_controller.get("/computes/my_compute/id", example=True)
|
||||
assert response.status == 200
|
||||
assert response.json["protocol"] == "http"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user