add repo.libs.faults.dict_as_toml
This commit is contained in:
parent
1d5bcf74c0
commit
773e8d118f
11 changed files with 16 additions and 34 deletions
|
@ -1,4 +0,0 @@
|
|||
<%
|
||||
from tomlkit import dumps as toml_dumps
|
||||
from bundlewrap.utils.text import toml_clean
|
||||
%>${toml_clean(toml_dumps(repo.libs.faults.resolve_faults(config), sort_keys=True))}
|
|
@ -68,10 +68,7 @@ for room, device_id in sorted(node.metadata.get('infobeamer-cms/rooms', {}).item
|
|||
|
||||
files = {
|
||||
'/opt/infobeamer-cms/settings.toml': {
|
||||
'content_type': 'mako',
|
||||
'context': {
|
||||
'config': config,
|
||||
},
|
||||
'content': repo.libs.faults.dict_as_toml(config),
|
||||
'triggers': {
|
||||
'svc_systemd:infobeamer-cms:restart',
|
||||
},
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
<%
|
||||
from tomlkit import dumps as toml_dumps
|
||||
from bundlewrap.utils.text import toml_clean
|
||||
%>${toml_clean(toml_dumps(repo.libs.faults.resolve_faults(config), sort_keys=True))}
|
|
@ -1,10 +1,7 @@
|
|||
assert node.has_bundle('infobeamer-cms') # uses same venv
|
||||
|
||||
files['/opt/infobeamer-monitor/config.toml'] = {
|
||||
'content_type': 'mako',
|
||||
'context': {
|
||||
'config': node.metadata.get('infobeamer-monitor'),
|
||||
},
|
||||
'content': repo.libs.faults.dict_as_toml(node.metadata.get('infobeamer-monitor')),
|
||||
'triggers': {
|
||||
'svc_systemd:infobeamer-monitor:restart',
|
||||
},
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
<%
|
||||
from tomlkit import dumps as toml_dumps
|
||||
from bundlewrap.utils.text import toml_clean
|
||||
%>${toml_clean(toml_dumps(repo.libs.faults.resolve_faults(node.metadata.get('jugendhackt_tools')), sort_keys=True))}
|
|
@ -47,7 +47,7 @@ actions['jugendhackt_tools_migrate'] = {
|
|||
}
|
||||
|
||||
files['/opt/jugendhackt_tools/config.toml'] = {
|
||||
'content_type': 'mako',
|
||||
'content': repo.libs.faults.dict_as_toml(node.metadata.get('jugendhackt_tools')),
|
||||
'triggers': {
|
||||
'svc_systemd:jugendhackt_tools:restart',
|
||||
},
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
<%
|
||||
from tomlkit import dumps as toml_dumps
|
||||
from bundlewrap.utils.text import toml_clean
|
||||
%>${toml_clean(toml_dumps(repo.libs.faults.resolve_faults(node.metadata['simple-icinga-dashboard']), sort_keys=True))}
|
|
@ -44,7 +44,7 @@ git_deploy = {
|
|||
|
||||
files = {
|
||||
'/opt/simple-icinga-dashboard/config.toml': {
|
||||
'content_type': 'mako',
|
||||
'content': repo.libs.faults.dict_as_toml(node.metadata.get('simple-icinga-dashboard')),
|
||||
'needs': {
|
||||
'git_deploy:/opt/simple-icinga-dashboard/src',
|
||||
},
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
<%
|
||||
from tomlkit import dumps as toml_dumps
|
||||
from bundlewrap.utils.text import toml_clean
|
||||
%>${toml_clean(toml_dumps(repo.libs.faults.resolve_faults(config), sort_keys=True))}
|
|
@ -93,10 +93,7 @@ for name, config in sorted(node.metadata.get('telegraf/input_plugins/prometheus'
|
|||
|
||||
files = {
|
||||
'/etc/telegraf/telegraf.conf': {
|
||||
'content_type': 'mako',
|
||||
'context': {
|
||||
'config': telegraf_config,
|
||||
},
|
||||
'content': repo.libs.faults.dict_as_toml(telegraf_config),
|
||||
'triggers': {
|
||||
'svc_systemd:telegraf:restart',
|
||||
},
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
from json import dumps, loads
|
||||
|
||||
from tomlkit import dumps as toml_dumps
|
||||
|
||||
from bundlewrap.metadata import metadata_to_json
|
||||
from bundlewrap.utils import Fault
|
||||
from bundlewrap.utils.text import toml_clean
|
||||
|
||||
|
||||
def resolve_faults(dictionary: dict) -> dict:
|
||||
|
@ -45,3 +48,11 @@ def dict_as_json(json):
|
|||
lambda o: metadata_to_json(o) + '\n',
|
||||
o=json
|
||||
)
|
||||
|
||||
|
||||
def dict_as_toml(toml):
|
||||
return Fault(
|
||||
'dict_as_toml',
|
||||
lambda o: toml_clean(toml_dumps(resolve_faults(o), sort_keys=True)) + '\n',
|
||||
o=toml
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue