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
Tags 0.3
No related merge requests found
...@@ -189,13 +189,18 @@ CONFIG_SCHEMA = { ...@@ -189,13 +189,18 @@ CONFIG_SCHEMA = {
}, },
"additionalProperties": False "additionalProperties": False
}, },
"ignored_folders": {
"type": "array",
"items": {"type": "string"}
}
}, },
"required": [ "required": [
"admin_username", "admin_username",
"admin_password", "admin_password",
"hostname", "hostname",
"inventory_provider", "inventory_provider",
"datasources" "datasources",
"ignored_folders"
] ]
} }
...@@ -206,7 +211,8 @@ def defaults(): ...@@ -206,7 +211,8 @@ def defaults():
"admin_password": "admin", "admin_password": "admin",
"hostname": "localhost:3000", "hostname": "localhost:3000",
"listen_port": 3001, "listen_port": 3001,
"datasources": {} "datasources": {},
"ignored_folders": []
} }
......
...@@ -124,7 +124,7 @@ def _search_dashboard(request: TokenRequest, dashboard: Dict, folder_id=None): ...@@ -124,7 +124,7 @@ def _search_dashboard(request: TokenRequest, dashboard: Dict, folder_id=None):
if r and isinstance(r, list): if r and isinstance(r, list):
if len(r) >= 1: if len(r) >= 1:
for dash in r: for dash in r:
if dash['title'].lower() == dashboard['title'].lower(): if dash['title'] == dashboard['title']:
definition = _get_dashboard(request, dash['uid']) definition = _get_dashboard(request, dash['uid'])
return definition return definition
return None return None
......
...@@ -51,15 +51,7 @@ def provision_folder(token_request, folder_name, dash, ...@@ -51,15 +51,7 @@ def provision_folder(token_request, folder_name, dash,
folder = find_folder(token_request, folder_name) folder = find_folder(token_request, folder_name)
tag = dash['tag'] tag = dash['tag']
interfaces = dash['interfaces'] interfaces = list(filter(_check_valid, 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))
# dashboard should include error panels # dashboard should include error panels
errors = dash.get('errors', False) errors = dash.get('errors', False)
......
...@@ -45,7 +45,8 @@ def data_config(): ...@@ -45,7 +45,8 @@ def data_config():
"isDefault": True, "isDefault": True,
"readOnly": False "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