bundlewrap/nodes.py

18 lines
547 B
Python
Raw Normal View History

from json import dumps as json_dumps
2020-02-23 10:13:45 +00:00
from os.path import join
from pathlib import Path
import bwpass
from bundlewrap.metadata import atomic
2020-02-23 10:13:45 +00:00
for node in Path(join(repo_path, "nodes")).rglob("*.py"):
with open(node, 'r') as f:
exec(f.read())
for name, data in nodes.items():
if 'hostname' not in data.keys():
data['hostname'] = '.'.join(reversed(name.split('.'))) + '.kunbox.net'
if 'hostname' not in data['metadata'].keys():
data['metadata']['hostname'] = '.'.join(reversed(name.split('.'))) + '.kunbox.net'