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
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
|
Loading…
Add table
Add a link
Reference in a new issue