add error_context() to groups.py and nodes.py

This commit is contained in:
Franzi 2022-02-07 06:57:58 +01:00
parent bc4f6e507a
commit 39e9ececa2
Signed by: kunsi
GPG Key ID: 12E3D2136B818350
2 changed files with 9 additions and 4 deletions

View File

@ -1,7 +1,10 @@
from os.path import join
from pathlib import Path
from bundlewrap.utils import error_context
groups = {}
for group in Path(join(repo_path, "groups")).rglob("*.py"):
with open(group, 'r') as f:
exec(f.read())
with error_context(filename=str(group)):
with open(group, 'r') as f:
exec(f.read())

View File

@ -4,10 +4,12 @@ from pathlib import Path
import bwpass
from bundlewrap.metadata import atomic
from bundlewrap.utils import error_context
for node in Path(join(repo_path, "nodes")).rglob("*.py"):
with open(node, 'r') as f:
exec(f.read())
with error_context(filename=str(node)):
with open(node, 'r') as f:
exec(f.read())
for name, data in nodes.items():
data.setdefault('hostname', '.'.join(reversed(name.split('.'))) + '.kunbox.net')