bundlewrap/bundles/backup-client/metadata.py
Franziska Kunsmann 2457d5b435
All checks were successful
bundlewrap/pipeline/head This commit looks good
bundles/backup-client: redirect stderr to /dev/null
We have monitoring to determine wether the backup succeeded or not.
No need for E-Mails, too.
2020-11-15 11:15:53 +01:00

23 lines
610 B
Python

from hashlib import md5
defaults = {
'backup-client': {
# unix user names cannot be longer than 32 characters.
# bundlewrap raises an error if the name is longer than 30 chars.
'user-name': 'c-' + md5(node.name.encode('UTF-8')).hexdigest()[:28],
},
}
@metadata_reactor
def cron(metadata):
if metadata.get('backups/exclude_from_backups', False):
return {}
return {
'cron': {
'backup': '{} 1 * * * root /usr/local/bin/generate-backup > /dev/null 2>&1'.format(
(node.magic_number % 60),
),
},
}