1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-28 03:08:14 +00:00

Fix issues with empty project variables. Fixes https://github.com/GNS3/gns3-gui/issues/2941

This commit is contained in:
grossmj 2020-03-14 17:22:43 +10:30
parent 392678e757
commit 868c39acfe
2 changed files with 7 additions and 1 deletions

View File

@ -171,6 +171,11 @@ def load_topology(path):
if "console_type" in node and node["console_type"] is None: if "console_type" in node and node["console_type"] is None:
node["console_type"] = "none" node["console_type"] = "none"
# make sure we can open a project with empty variable name
variables = topo.get("variables")
if variables:
topo["variables"] = [var for var in variables if var.get("name")]
try: try:
_check_topology_schema(topo) _check_topology_schema(topo)
except aiohttp.web.HTTPConflict as e: except aiohttp.web.HTTPConflict as e:

View File

@ -38,7 +38,8 @@ VARIABLES_OBJECT_SCHEMA = {
"properties": { "properties": {
"name": { "name": {
"type": "string", "type": "string",
"description": "Variable name" "description": "Variable name",
"minLength": 1
}, },
"value": { "value": {
"type": "string", "type": "string",