bundlewrap/bundles/systemd-networkd/metadata.py
Franziska Kunsmann e9ce0ce869
All checks were successful
bundlewrap/pipeline/head This commit looks good
bundles/systemd-networkd: add missing key to .provides()
2021-04-24 12:38:51 +02:00

56 lines
1.3 KiB
Python

defaults = {
'apt': {
'packages': {
'resolvconf': {
'installed': False,
},
},
},
}
@metadata_reactor.provides(
'interfaces',
)
def add_vlan_infos_to_interface(metadata):
interfaces = {}
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)
return {
'interfaces': interfaces,
}
@metadata_reactor.provides(
'telegraf/input_plugins/builtin/bond',
'telegraf/additional_capabilities',
)
def telegraf(metadata):
if not node.has_bundle('telegraf'):
raise DoNotRunAgain
if metadata.get('systemd-networkd/bonds', {}):
return {
'telegraf': {
'input_plugins': {
'builtin': {
'bond': [{
'bond_interfaces': list(sorted(metadata.get('systemd-networkd/bonds').keys())),
}],
},
},
'additional_capabilities': {
'CAP_NET_ADMIN',
},
},
}
return {}