bundlewrap/bundles/cron/items.py

41 lines
780 B
Python

if node.os == 'arch':
service_name = 'cronie'
package_name = 'pkg_pacman:cronie'
else:
service_name = 'cron'
package_name = 'pkg_apt:cron'
files = {
'/etc/crontab': {
'content_type': 'mako',
'context': {
'min': (node.magic_number%60),
},
},
}
directories = {
'/etc/cron.d': {
'purge': True,
'needs': {
'pkg_apt:',
},
},
}
svc_systemd = {
service_name: {
'needs': {
package_name,
},
},
}
for crontab, content in node.metadata.get('cron/jobs', {}).items():
files['/etc/cron.d/{}'.format(crontab)] = {
'source': 'cron_template',
'content_type': 'mako',
'context': {
'cron': content,
}
}