diff --git a/groups.py b/groups.py index 268c341..d99ced7 100644 --- a/groups.py +++ b/groups.py @@ -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()) diff --git a/nodes.py b/nodes.py index 68b717d..75e6f1f 100644 --- a/nodes.py +++ b/nodes.py @@ -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')