bundles/dhcpd: catch keyerrors for nodes which do dhcp in unmanaged networks

This commit is contained in:
Franzi 2021-01-07 22:14:17 +01:00
parent 2d42e5f7dd
commit fb42f9e667
Signed by: kunsi
GPG key ID: 12E3D2136B818350

View file

@ -18,10 +18,13 @@ def get_static_allocations(metadata):
for identifier, interface in rnode.metadata.get('interfaces', {}).items(): for identifier, interface in rnode.metadata.get('interfaces', {}).items():
if interface.get('dhcp', False): if interface.get('dhcp', False):
allocations[rnode.name] = { try:
'ipv4': sorted(interface['ips'])[0], allocations[rnode.name] = {
'mac': interface['mac'], 'ipv4': sorted(interface['ips'])[0],
} 'mac': interface['mac'],
}
except KeyError:
pass
return { return {
'dhcpd': { 'dhcpd': {