Skip to content
Snippets Groups Projects
Commit 50b36fab authored by Bjarke Madsen's avatar Bjarke Madsen
Browse files

validate config for ignored folders

parent 699ee77b
No related branches found
No related tags found
No related merge requests found
......@@ -189,13 +189,18 @@ CONFIG_SCHEMA = {
},
"additionalProperties": False
},
"ignored_folders": {
"type": "array",
"items": {"type": "string"}
}
},
"required": [
"admin_username",
"admin_password",
"hostname",
"inventory_provider",
"datasources"
"datasources",
"ignored_folders"
]
}
......@@ -206,7 +211,8 @@ def defaults():
"admin_password": "admin",
"hostname": "localhost:3000",
"listen_port": 3001,
"datasources": {}
"datasources": {},
"ignored_folders": []
}
......
......@@ -124,7 +124,7 @@ def _search_dashboard(request: TokenRequest, dashboard: Dict, folder_id=None):
if r and isinstance(r, list):
if len(r) >= 1:
for dash in r:
if dash['title'].lower() == dashboard['title'].lower():
if dash['title'] == dashboard['title']:
definition = _get_dashboard(request, dash['uid'])
return definition
return None
......
......@@ -51,15 +51,7 @@ def provision_folder(token_request, folder_name, dash,
folder = find_folder(token_request, folder_name)
tag = dash['tag']
interfaces = dash['interfaces']
empty_names = [iface for iface in interfaces if not _check_valid(iface)]
if any(empty_names):
for iface in empty_names:
logger.info('Invalid dashboard name on interface:')
logger.info(json.dumps(iface, indent=2))
interfaces = list(filter(_check_valid, interfaces))
interfaces = list(filter(_check_valid, dash['interfaces']))
# dashboard should include error panels
errors = dash.get('errors', False)
......
......@@ -45,7 +45,8 @@ def data_config():
"isDefault": True,
"readOnly": False
}
}
},
"ignored_folders": []
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment