bundlewrap/bundles/systemd-networkd/metadata.py
Franziska Kunsmann 61e5591628
All checks were successful
kunsi/bundlewrap/pipeline/head This commit looks good
bundles/systemd-networkd: fix bridge-in-bridge-setup on home.nas not working properly
2021-10-11 20:46:07 +02:00

46 lines
1.1 KiB
Python

defaults = {
'apt': {
'packages': {
'resolvconf': {
'installed': False,
},
},
},
}
@metadata_reactor.provides(
'interfaces',
'systemd-networkd/bridges',
)
def add_vlan_infos_to_interface(metadata):
interfaces = {}
bridges = {}
for iface in metadata.get('interfaces', {}):
if '.' not in iface:
continue
interface,vlan = iface.split('.')
interfaces.setdefault(interface, {}).setdefault('vlans', set())
interfaces[interface]['vlans'].add(vlan)
for bridge, config in metadata.get('systemd-networkd/bridges', {}).items():
for iface in config.get('match', {}):
if '.' not in iface:
continue
interface,vlan = iface.split('.')
bridges.setdefault(interface, {}).setdefault('vlans', set())
bridges[interface]['vlans'].add(vlan)
interfaces.setdefault(iface, {'ignore': True})
return {
'interfaces': interfaces,
'systemd-networkd': {
'bridges': bridges,
},
}