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

Exclude GWS (in)direct from appropriate orgs and show in IAS dashboard

parent c3037824
No related branches found
No related tags found
No related merge requests found
...@@ -77,6 +77,8 @@ DEFAULT_ORGANIZATIONS = [ ...@@ -77,6 +77,8 @@ DEFAULT_ORGANIZATIONS = [
"IAS PUBLIC": True, "IAS PUBLIC": True,
"IAS UPSTREAM": True, "IAS UPSTREAM": True,
"GWS PHY Upstream": True, "GWS PHY Upstream": True,
"GWS Direct": True,
"GWS Indirect": True,
} }
}, },
{ {
...@@ -116,7 +118,9 @@ DEFAULT_ORGANIZATIONS = [ ...@@ -116,7 +118,9 @@ DEFAULT_ORGANIZATIONS = [
"IAS PRIVATE": True, "IAS PRIVATE": True,
"IAS PUBLIC": True, "IAS PUBLIC": True,
"IAS UPSTREAM": True, "IAS UPSTREAM": True,
"GWS PHY Upstream": True "GWS PHY Upstream": True,
"GWS Direct": True,
"GWS Indirect": True,
} }
} }
] ]
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
"folderId": null, "folderId": null,
"gridPos": { "gridPos": {
"h": 25, "h": 25,
"w": 6, "w": 4,
"x": 0, "x": 0,
"y": 0 "y": 0
}, },
...@@ -114,8 +114,8 @@ ...@@ -114,8 +114,8 @@
"folderId": null, "folderId": null,
"gridPos": { "gridPos": {
"h": 25, "h": 25,
"w": 6, "w": 4,
"x": 6, "x": 4,
"y": 0 "y": 0
}, },
"headings": false, "headings": false,
...@@ -182,8 +182,8 @@ ...@@ -182,8 +182,8 @@
"folderId": null, "folderId": null,
"gridPos": { "gridPos": {
"h": 25, "h": 25,
"w": 6, "w": 4,
"x": 12, "x": 8,
"y": 0 "y": 0
}, },
"headings": false, "headings": false,
...@@ -250,8 +250,8 @@ ...@@ -250,8 +250,8 @@
"folderId": null, "folderId": null,
"gridPos": { "gridPos": {
"h": 25, "h": 25,
"w": 6, "w": 4,
"x": 18, "x": 12,
"y": 0 "y": 0
}, },
"headings": false, "headings": false,
...@@ -306,6 +306,142 @@ ...@@ -306,6 +306,142 @@
"timeShift": null, "timeShift": null,
"title": "IAS PRIVATE", "title": "IAS PRIVATE",
"type": "dashlist" "type": "dashlist"
},
{
"datasource": null,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"folderId": null,
"gridPos": {
"h": 25,
"w": 4,
"x": 16,
"y": 0
},
"headings": false,
"id": 6,
"limit": 100,
"pluginVersion": "7.1.4",
"query": "",
"recent": false,
"search": true,
"starred": false,
"tags": [
"GWS_DIRECT"
],
"targets": [
{
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"orderByTime": "ASC",
"policy": "default",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": []
}
],
"timeFrom": null,
"timeShift": null,
"title": "GWS Direct",
"type": "dashlist"
},
{
"datasource": null,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"folderId": null,
"gridPos": {
"h": 25,
"w": 4,
"x": 20,
"y": 0
},
"headings": false,
"id": 7,
"limit": 100,
"pluginVersion": "7.1.4",
"query": "",
"recent": false,
"search": true,
"starred": false,
"tags": [
"GWS_INDIRECT"
],
"targets": [
{
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"orderByTime": "ASC",
"policy": "default",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": []
}
],
"timeFrom": null,
"timeShift": null,
"title": "GWS Indirect",
"type": "dashlist"
} }
], ],
"schemaVersion": 26, "schemaVersion": 26,
...@@ -338,3 +474,4 @@ ...@@ -338,3 +474,4 @@
"title": "IAS", "title": "IAS",
"version": 1 "version": 1
} }
...@@ -310,8 +310,7 @@ def provision(config): ...@@ -310,8 +310,7 @@ def provision(config):
# fetch GWS direct data and provision related dashboards # fetch GWS direct data and provision related dashboards
logger.info('Provisioning GWS Indirect dashboards') logger.info('Provisioning GWS Indirect dashboards')
folder_name = 'GWS Indirect' folder_name = 'GWS Indirect'
exclude_indirect = excluded_folders.get(folder_name, []) exclude_indirect = excluded_folders.get(folder_name, False)
exclude_indirect = list(map(lambda f: f.lower(), exclude_indirect))
if isinstance(exclude_indirect, bool) and exclude_indirect: if isinstance(exclude_indirect, bool) and exclude_indirect:
# don't provision GWS Direct folder # don't provision GWS Direct folder
delete_folder(token_request, folder_name) delete_folder(token_request, folder_name)
...@@ -321,14 +320,9 @@ def provision(config): ...@@ -321,14 +320,9 @@ def provision(config):
gws_indirect_data = get_gws_indirect( gws_indirect_data = get_gws_indirect(
config['inventory_provider']) config['inventory_provider'])
provisioned = [] provisioned = []
dashes = generate_indirect(gws_indirect_data, datasource_name) dashes = generate_indirect(gws_indirect_data, datasource_name)
for dashboard in dashes: for dashboard in dashes:
rendered = render_dashboard(dashboard) rendered = render_dashboard(dashboard)
if rendered.get('title').lower() in exclude_indirect:
executor.submit(delete_dashboard, token_request,
rendered, folder['id'])
continue
provisioned.append(executor.submit(create_dashboard, provisioned.append(executor.submit(create_dashboard,
token_request, token_request,
rendered, folder['id'])) rendered, folder['id']))
...@@ -338,8 +332,7 @@ def provision(config): ...@@ -338,8 +332,7 @@ def provision(config):
# fetch GWS direct data and provision related dashboards # fetch GWS direct data and provision related dashboards
logger.info('Provisioning GWS Direct dashboards') logger.info('Provisioning GWS Direct dashboards')
folder_name = 'GWS Direct' folder_name = 'GWS Direct'
exclude_gws = excluded_folders.get(folder_name, []) exclude_gws = excluded_folders.get(folder_name, False)
exclude_gws = list(map(lambda f: f.lower(), exclude_gws))
if isinstance(exclude_gws, bool) and exclude_gws: if isinstance(exclude_gws, bool) and exclude_gws:
# don't provision GWS Direct folder # don't provision GWS Direct folder
delete_folder(token_request, folder_name) delete_folder(token_request, folder_name)
...@@ -351,10 +344,6 @@ def provision(config): ...@@ -351,10 +344,6 @@ def provision(config):
for dashboard in generate_gws(gws_data, datasource_name): for dashboard in generate_gws(gws_data, datasource_name):
rendered = render_dashboard(dashboard) rendered = render_dashboard(dashboard)
if rendered.get('title').lower() in exclude_gws:
executor.submit(delete_dashboard, token_request,
rendered, folder['id'])
continue
provisioned.append(executor.submit(create_dashboard, provisioned.append(executor.submit(create_dashboard,
token_request, token_request,
rendered, folder['id'])) rendered, folder['id']))
......
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