nodes.py: use setdefault()
This commit is contained in:
parent
3a3ce5c5fd
commit
226fac0d78
1 changed files with 2 additions and 5 deletions
7
nodes.py
7
nodes.py
|
@ -10,8 +10,5 @@ for node in Path(join(repo_path, "nodes")).rglob("*.py"):
|
||||||
exec(f.read())
|
exec(f.read())
|
||||||
|
|
||||||
for name, data in nodes.items():
|
for name, data in nodes.items():
|
||||||
if 'hostname' not in data.keys():
|
data.setdefault('hostname', '.'.join(reversed(name.split('.'))) + '.kunbox.net')
|
||||||
data['hostname'] = '.'.join(reversed(name.split('.'))) + '.kunbox.net'
|
data.setdefault('metadata', {}).setdefault('hostname', '.'.join(reversed(name.split('.'))) + '.kunbox.net')
|
||||||
|
|
||||||
if 'hostname' not in data['metadata'].keys():
|
|
||||||
data['metadata']['hostname'] = '.'.join(reversed(name.split('.'))) + '.kunbox.net'
|
|
||||||
|
|
Loading…
Reference in a new issue