Browse Source

nodes.py: use setdefault()

main
Franzi 2 weeks ago
parent
commit
226fac0d78
Signed by: kunsi GPG Key ID: 12E3D2136B818350
  1. 7
      nodes.py

7
nodes.py

@ -10,8 +10,5 @@ for node in Path(join(repo_path, "nodes")).rglob("*.py"):
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'
data.setdefault('hostname', '.'.join(reversed(name.split('.'))) + '.kunbox.net')
data.setdefault('metadata', {}).setdefault('hostname', '.'.join(reversed(name.split('.'))) + '.kunbox.net')

Loading…
Cancel
Save