Revert "bundles/systemd-networkd: no need for a specific order in /etc/systemd/network/"
All checks were successful
bundlewrap/pipeline/head This commit looks good

This reverts commit b679f568eb.

Documentation says order is irrelevant, but it is not. If we do not use
ordering, vlan interfaces are defined before the parent interfaces, which
leads to systemd-networkd not applying config for the parent interfaces.
This commit is contained in:
Franzi 2021-04-10 12:22:08 +02:00
parent 0d1a220b7b
commit ef84b3f889
Signed by: kunsi
GPG key ID: 12E3D2136B818350

View file

@ -41,7 +41,7 @@ for interface, config in node.metadata['interfaces'].items():
if '.' in interface:
vlan_id = int(interface.split('.')[1])
vlan_hex = '%02x' % (vlan_id % 255)
files[f'/etc/systemd/network/{interface}.netdev'] = {
files['/etc/systemd/network/60-iface-{}.netdev'.format(interface)] = {
'source': 'template-iface-vlan.netdev',
'content_type': 'mako',
'context': {
@ -56,9 +56,12 @@ for interface, config in node.metadata['interfaces'].items():
'svc_systemd:systemd-networkd:restart',
},
}
weight = 61
else:
weight = 50
if not config.get('ignore', False):
files[f'/etc/systemd/network/{interface}.network'] = {
files['/etc/systemd/network/{}-iface-{}.network'.format(weight, interface)] = {
'source': template,
'content_type': 'mako',
'context': {
@ -74,7 +77,7 @@ for interface, config in node.metadata['interfaces'].items():
}
for bond, config in node.metadata.get('systemd-networkd/bonds', {}).items():
files[f'/etc/systemd/network/{bond}.netdev'] = {
files['/etc/systemd/network/20-bond-{}.netdev'.format(bond)] = {
'source': 'template-bond.netdev',
'content_type': 'mako',
'context': {
@ -89,7 +92,7 @@ for bond, config in node.metadata.get('systemd-networkd/bonds', {}).items():
'svc_systemd:systemd-networkd:restart',
},
}
files[f'/etc/systemd/network/{bond}.network'] = {
files['/etc/systemd/network/21-bond-{}.network'.format(bond)] = {
'source': 'template-bond.network',
'content_type': 'mako',
'context': {
@ -106,7 +109,7 @@ for bond, config in node.metadata.get('systemd-networkd/bonds', {}).items():
}
for brname, config in node.metadata.get('systemd-networkd/bridges', {}).items():
files[f'/etc/systemd/network/{brname}.netdev'] = {
files['/etc/systemd/network/30-bridge-{}.netdev'.format(brname)] = {
'source': 'template-bridge.netdev',
'content_type': 'mako',
'context': {
@ -119,7 +122,7 @@ for brname, config in node.metadata.get('systemd-networkd/bridges', {}).items():
'svc_systemd:systemd-networkd:restart',
},
}
files[f'/etc/systemd/network/{brname}.network'] = {
files['/etc/systemd/network/31-bridge-{}.network'.format(brname)] = {
'source': 'template-bridge.network',
'content_type': 'mako',
'context': {