diff --git a/bundles/arch-with-gui/metadata.py b/bundles/arch-with-gui/metadata.py index 2748af1..869a7f9 100644 --- a/bundles/arch-with-gui/metadata.py +++ b/bundles/arch-with-gui/metadata.py @@ -80,9 +80,6 @@ defaults = { 'xdotool': {}, # needed for maim window selection }, }, - 'systemd-networkd': { - 'enable-resolved': True, - }, } @metadata_reactor.provides( diff --git a/bundles/systemd-networkd/items.py b/bundles/systemd-networkd/items.py index cd33380..aa50ca8 100644 --- a/bundles/systemd-networkd/items.py +++ b/bundles/systemd-networkd/items.py @@ -10,16 +10,12 @@ files = { svc_systemd = { 'systemd-networkd': {}, + 'systemd-resolved': { + 'running': False, + 'enabled': False, + }, } -if node.metadata.get('systemd-networkd/enable-resolved', False): - svc_systemd['systemd-resolved'] = {} -else: - files['/etc/resolv.conf'] = { - 'content_type': 'mako', - } - - directories = { '/etc/systemd/network': { 'purge': True, @@ -34,16 +30,16 @@ directories = { mac_host_prefix = '%04x' % (node.magic_number % 65534) generated_mac = f'52:54:00:{mac_host_prefix[0:2]}:{mac_host_prefix[2:4]}:{{}}' +all_interfaces_use_dhcp = True -# Don't use .get() here. We might end up with a node without a network -# config! -for interface, config in node.metadata['interfaces'].items(): +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: vlan_id = int(interface.split('.')[1]) @@ -94,6 +90,11 @@ for interface, config in node.metadata['interfaces'].items(): }, } +if not all_interfaces_use_dhcp: + files['/etc/resolv.conf'] = { + 'content_type': 'mako', + } + for bond, config in node.metadata.get('systemd-networkd/bonds', {}).items(): files[f'/etc/systemd/network/{bond}.netdev'] = { 'source': 'template-bond.netdev', diff --git a/nodes/kunsi-t470.py b/nodes/kunsi-t470.py index 0768b1f..61f21d4 100644 --- a/nodes/kunsi-t470.py +++ b/nodes/kunsi-t470.py @@ -80,7 +80,6 @@ nodes['kunsi-t470'] = { 'install_gui': True, }, 'systemd-networkd': { - 'enable-resolved': True, 'bridges': { 'br0': { 'match': {