bundlewrap/bundles/dhcpd/metadata.py
2020-11-13 23:30:49 +01:00

26 lines
625 B
Python

defaults = {
'apt': {
'packages': {
'isc-dhcpd-server': {},
},
},
}
@metadata_reactor
def get_static_allocations(metadata):
allocations = {}
for rnode in repo.nodes_in_group('home'):
for identifier, interface in rnode.metadata.get('interfaces', {}).items():
if interface.get('dhcp', False):
allocations[rnode.name] = {
'ipv4': sorted(interface['ips'])[0],
'mac': interface['mac'],
}
return {
'dhcpd': {
'fixed_allocations': allocations,
}
}