bundlewrap/bundles/hetzner-dyndns/metadata.py
2025-04-16 22:41:20 +02:00

26 lines
748 B
Python

defaults = {
'systemd-timers': {
'timers': {
'hetzner-dyndns-update': {
'when': 'hourly',
},
},
},
}
@metadata_reactor.provides(
'systemd-timers/timers/hetzner-dyndns-update',
)
def command_template(metadata):
empty_command = f'/usr/bin/python3 /opt/hetzner-dyndns/src/hetzner-api-dyndns.py --api_key {{}} --zone {node.metadata.get('hetzner-dyndns/zone')} --record {node.metadata.get('hetzner-dyndns/record')}'
return {
'systemd-timers': {
'timers': {
'hetzner-dyndns-update': {
'command': node.metadata.get('hetzner-dyndns/api_key').format_into(empty_command),
},
},
},
}