2021-07-04 17:27:12 +00:00
|
|
|
from json import dumps as json_dumps
|
2020-02-23 10:13:45 +00:00
|
|
|
from os.path import join
|
|
|
|
from pathlib import Path
|
|
|
|
|
2021-07-02 17:29:52 +00:00
|
|
|
import bwpass
|
2023-02-05 16:30:58 +00:00
|
|
|
|
2021-05-15 04:58:42 +00:00
|
|
|
from bundlewrap.metadata import atomic
|
2022-02-07 05:57:58 +00:00
|
|
|
from bundlewrap.utils import error_context
|
2021-05-15 04:58:42 +00:00
|
|
|
|
2020-02-23 10:13:45 +00:00
|
|
|
for node in Path(join(repo_path, "nodes")).rglob("*.py"):
|
2022-02-07 05:57:58 +00:00
|
|
|
with error_context(filename=str(node)):
|
|
|
|
with open(node, 'r') as f:
|
|
|
|
exec(f.read())
|
2020-03-27 12:28:37 +00:00
|
|
|
|
|
|
|
for name, data in nodes.items():
|
2022-01-04 10:33:18 +00:00
|
|
|
data.setdefault('hostname', '.'.join(reversed(name.split('.'))) + '.kunbox.net')
|
|
|
|
data.setdefault('metadata', {}).setdefault('hostname', '.'.join(reversed(name.split('.'))) + '.kunbox.net')
|
2023-03-28 20:52:10 +00:00
|
|
|
|
|
|
|
if 'password' in data:
|
|
|
|
data['password'] = vault.decrypt(data['password'])
|