bundles/dhcpd: rework metadata
All checks were successful
bundlewrap/pipeline/head This commit looks good

This commit is contained in:
Franzi 2021-04-20 18:17:52 +02:00
parent 3bd851aae5
commit 24362768fb
Signed by: kunsi
GPG key ID: 12E3D2136B818350
5 changed files with 17 additions and 38 deletions

View file

@ -1,19 +1,21 @@
#dhcpd.conf
<%
import re
import re
from ipaddress import ip_network
%>
ddns-update-style none;
authoritative;
% for identifier, subnet in dhcp_config.get('subnets', {}).items():
# subnet '${identifier}'
subnet ${subnet['subnet']} netmask ${subnet['netmask']} {
% for interface, subnet in sorted(dhcp_config.get('subnets', {}).items()):
<%
network = ip_network(subnet['subnet'])
%>
# interface ${interface} provides ${subnet['subnet']}
subnet ${network.network_address} netmask ${network.netmask} {
% if subnet.get('range_lower', None) and subnet.get('range_higher', None):
range ${subnet['range_lower']} ${subnet['range_higher']};
% endif
interface "${subnet['interface']}";
interface "${interface}";
default-lease-time ${subnet.get('default-lease-time', 600)};
max-lease-time ${subnet.get('max-lease-time', 3600)};
% for option, value in sorted(subnet.get('options', {}).items()):

View file

@ -14,5 +14,5 @@
# On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
# Separate multiple interfaces with spaces, e.g. "eth0 eth1".
INTERFACESv4="${listen_interfaces}"
INTERFACESv4="${' '.join(sorted(node.metadata.get('dhcpd/subnets', {})))}"
INTERFACESv6=""