config management repository for all servers operated or managed by me
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
547 B

from json import dumps as json_dumps
from os.path import join
from pathlib import Path
import bwpass
from bundlewrap.metadata import atomic
for node in Path(join(repo_path, "nodes")).rglob("*.py"):
with open(node, 'r') as f:
for name, data in nodes.items():
if 'hostname' not in data.keys():
data['hostname'] = '.'.join(reversed(name.split('.'))) + ''
if 'hostname' not in data['metadata'].keys():
data['metadata']['hostname'] = '.'.join(reversed(name.split('.'))) + ''