bundlewrap/bundles/wide-dhcp6c/items.py

55 lines
1.4 KiB
Python

if node.has_bundle('pppd'):
files['/etc/ppp/ip-up.d/wide-dhcp6c'] = {
'source': 'ip-up',
'content_type': 'mako',
'context': node.metadata.get('wide-dhcp6c'),
'mode': '0755',
'triggers': {
'svc_systemd:wide-dhcpv6-client:restart',
},
}
files['/etc/ppp/ip-down.d/wide-dhcp6c'] = {
'source': 'ip-down',
'content_type': 'mako',
'context': node.metadata.get('wide-dhcp6c'),
'mode': '0755',
'triggers': {
'svc_systemd:wide-dhcpv6-client:restart',
},
}
# Will be started and stopped by pppd.
SHOULD_BE_RUNNING = None
SHOULD_BE_ENABLED = False
else:
SHOULD_BE_RUNNING = True
SHOULD_BE_ENABLED = True
files['/etc/wide-dhcpv6/dhcp6c.conf'] = {
'content_type': 'mako',
'context': node.metadata.get('wide-dhcp6c'),
'triggers': {
'svc_systemd:wide-dhcpv6-client:restart',
},
}
files['/etc/systemd/system/wide-dhcpv6-client.service'] = {
'content_type': 'mako',
'context': node.metadata.get('wide-dhcp6c'),
'triggers': {
'action:systemd-reload',
'svc_systemd:wide-dhcpv6-client:restart',
},
}
svc_systemd = {
'wide-dhcpv6-client': {
'running': SHOULD_BE_RUNNING,
'enabled': SHOULD_BE_ENABLED,
'needs': {
'file:/etc/systemd/system/wide-dhcpv6-client.service',
'file:/etc/wide-dhcpv6/dhcp6c.conf',
},
},
}