bundles/systemd-networkd: combine templates for interfaces

This commit is contained in:
Franzi 2023-09-24 18:54:47 +02:00
parent e27e374983
commit 53ff288d89
Signed by: kunsi
GPG key ID: 12E3D2136B818350
3 changed files with 26 additions and 38 deletions

View file

@ -40,9 +40,7 @@ for interface, config in node.metadata.get('interfaces').items():
if config.get('dhcp', False):
if 'vlans' in config:
raise BundleError(f'{node.name} interface {interface} cannot use vlans and dhcp!')
template = 'template-iface-dhcp.network'
else:
template = 'template-iface-nodhcp.network'
all_interfaces_use_dhcp = False
if '.' in interface:
@ -80,7 +78,7 @@ for interface, config in node.metadata.get('interfaces').items():
if not config.get('ignore', False):
files[f'/etc/systemd/network/{interface}.network'] = {
'source': template,
'source': 'template-iface.network',
'content_type': 'mako',
'context': {
'interface': interface,