bundles/simple-icinga-dashboard: config is a toml file now
Some checks failed
bundlewrap/pipeline/head There was a failure building this commit
Some checks failed
bundlewrap/pipeline/head There was a failure building this commit
This commit is contained in:
parent
b33ddaadb5
commit
36bd6f5755
5 changed files with 39 additions and 26 deletions
|
@ -1,16 +0,0 @@
|
||||||
[icinga2_api]
|
|
||||||
baseurl = ${api_url}
|
|
||||||
username = ${api_user}
|
|
||||||
password = ${api_password}
|
|
||||||
|
|
||||||
[filters]
|
|
||||||
hosts = ${host_filter}
|
|
||||||
services = ${service_filter}
|
|
||||||
|
|
||||||
[prettify]
|
|
||||||
% for search, replace in sorted(replacements.items()):
|
|
||||||
${search.lower()} = ${replace}
|
|
||||||
% endfor
|
|
||||||
|
|
||||||
[output]
|
|
||||||
filename = /opt/simple-icinga-dashboard/out/index.html
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
from tomlkit import dumps as toml_dumps
|
||||||
|
|
||||||
|
from bundlewrap.utils.text import toml_clean
|
||||||
|
|
||||||
users = {
|
users = {
|
||||||
'icinga_dashboard': {
|
'icinga_dashboard': {
|
||||||
'home': '/opt/simple-icinga-dashboard',
|
'home': '/opt/simple-icinga-dashboard',
|
||||||
|
@ -19,9 +23,8 @@ git_deploy = {
|
||||||
}
|
}
|
||||||
|
|
||||||
files = {
|
files = {
|
||||||
'/opt/simple-icinga-dashboard/src/config.conf': {
|
'/opt/simple-icinga-dashboard/src/config.toml': {
|
||||||
'content_type': 'mako',
|
'content': toml_clean(toml_dumps(repo.libs.toml.dict_to_toml(node.metadata['simple-icinga-dashboard']))),
|
||||||
'context': node.metadata['simple-icinga-dashboard'],
|
|
||||||
'needs': {
|
'needs': {
|
||||||
'git_deploy:/opt/simple-icinga-dashboard/src',
|
'git_deploy:/opt/simple-icinga-dashboard/src',
|
||||||
},
|
},
|
||||||
|
|
|
@ -9,4 +9,9 @@ defaults = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
'simple-icinga-dashboard': {
|
||||||
|
'output': {
|
||||||
|
'filename': '/opt/simple-icinga-dashboard/out/index.html',
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
19
libs/toml.py
Normal file
19
libs/toml.py
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
from tomlkit import document as toml_document
|
||||||
|
|
||||||
|
from bundlewrap.utils import Fault
|
||||||
|
|
||||||
|
# Copied from bw core, because bw core doesn't support faults
|
||||||
|
def dict_to_toml(dict_obj):
|
||||||
|
toml_doc = toml_document()
|
||||||
|
for key, value in sorted(dict_obj.items()):
|
||||||
|
if isinstance(value, tuple):
|
||||||
|
toml_doc[key] = list(value)
|
||||||
|
elif isinstance(value, set):
|
||||||
|
toml_doc[key] = sorted(value)
|
||||||
|
elif isinstance(value, dict):
|
||||||
|
toml_doc[key] = dict_to_toml(value)
|
||||||
|
elif isinstance(value, Fault):
|
||||||
|
toml_doc[key] = str(value)
|
||||||
|
else:
|
||||||
|
toml_doc[key] = value
|
||||||
|
return toml_doc
|
|
@ -33,7 +33,6 @@ nodes['ovh.icinga2'] = {
|
||||||
'dashboard': {
|
'dashboard': {
|
||||||
'password': vault.password_for('ovh.icinga2 icinga2 api_user dashboard'),
|
'password': vault.password_for('ovh.icinga2 icinga2 api_user dashboard'),
|
||||||
'permissions': {
|
'permissions': {
|
||||||
'objects/query/Host',
|
|
||||||
'objects/query/Service'
|
'objects/query/Service'
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -106,12 +105,15 @@ nodes['ovh.icinga2'] = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'simple-icinga-dashboard': {
|
'simple-icinga-dashboard': {
|
||||||
'api_url': 'https://127.0.0.1:5665',
|
'icinga2_api': {
|
||||||
'api_user': 'dashboard',
|
'baseurl': 'https://127.0.0.1:5665',
|
||||||
'api_password': vault.password_for('ovh.icinga2 icinga2 api_user dashboard'),
|
'username': 'dashboard',
|
||||||
'host_filter': '"checks_with_sms" in host.groups',
|
'password': vault.password_for('ovh.icinga2 icinga2 api_user dashboard'),
|
||||||
'service_filter': '"checks_with_sms" in service.groups',
|
},
|
||||||
'replacements': {
|
'filters': {
|
||||||
|
'services': '"checks_with_sms" in service.groups',
|
||||||
|
},
|
||||||
|
'prettify': {
|
||||||
'CONTENT': '',
|
'CONTENT': '',
|
||||||
'NGINX': 'WEBSERVER',
|
'NGINX': 'WEBSERVER',
|
||||||
'PROCESS': 'SERVICE',
|
'PROCESS': 'SERVICE',
|
||||||
|
|
Loading…
Reference in a new issue