mirror of
https://github.com/GNS3/gns3-server.git
synced 2024-11-17 09:14:52 +02:00
Show topology path when check topology schema fails.
This commit is contained in:
parent
b1b3338e3c
commit
41ba215e32
@ -50,7 +50,7 @@ class DynamipsNodeValidation(DynamipsCreate):
|
||||
name: Optional[str] = None
|
||||
|
||||
|
||||
def _check_topology_schema(topo):
|
||||
def _check_topology_schema(topo, path):
|
||||
try:
|
||||
Topology.parse_obj(topo)
|
||||
|
||||
@ -60,7 +60,7 @@ def _check_topology_schema(topo):
|
||||
DynamipsNodeValidation.parse_obj(node.get("properties", {}))
|
||||
|
||||
except pydantic.ValidationError as e:
|
||||
error = f"Invalid data in topology file: {e}"
|
||||
error = f"Invalid data in topology file {path}: {e}"
|
||||
log.critical(error)
|
||||
raise ControllerError(error)
|
||||
|
||||
@ -117,7 +117,7 @@ def project_to_topology(project):
|
||||
data["topology"]["computes"].append(compute)
|
||||
elif isinstance(compute, dict):
|
||||
data["topology"]["computes"].append(compute)
|
||||
_check_topology_schema(data)
|
||||
_check_topology_schema(data, project.path)
|
||||
return data
|
||||
|
||||
|
||||
@ -187,7 +187,7 @@ def load_topology(path):
|
||||
topo["variables"] = [var for var in variables if var.get("name")]
|
||||
|
||||
try:
|
||||
_check_topology_schema(topo)
|
||||
_check_topology_schema(topo, path)
|
||||
except ControllerError as e:
|
||||
log.error("Can't load the topology %s", path)
|
||||
raise e
|
||||
|
Loading…
Reference in New Issue
Block a user