wol on backup

This commit is contained in:
mwiegand 2022-02-12 18:42:27 +01:00
parent e406db30f9
commit 4e56ba6da0
2 changed files with 13 additions and 1 deletions

View file

@ -1,5 +1,10 @@
#!/bin/bash
# FIXME: inelegant
% if wol_command:
${wol_command}
% endif
for path in $(jq -r '.paths | .[]' < /etc/backup/config.json)
do
/opt/backup/backup_path "$path"

View file

@ -1,9 +1,16 @@
from json import dumps
backup_node = repo.get_node(node.metadata.get('backup/server'))
directories['/opt/backup'] = {}
files['/opt/backup/backup_all'] = {
'mode': '700',
'content_type': 'mako',
'context': {
'wol_command': backup_node.metadata.get('wol-sleeper/wake_command', False),
},
}
files['/opt/backup/backup_path'] = {
'mode': '700',
@ -20,7 +27,7 @@ directories['/etc/backup'] = {}
files['/etc/backup/config.json'] = {
'content': dumps(
{
'server_hostname': repo.get_node(node.metadata.get('backup/server')).metadata.get('backup-server/hostname'),
'server_hostname': backup_node.metadata.get('backup-server/hostname'),
'client_uuid': node.metadata.get('id'),
'paths': sorted(set(node.metadata.get('backup/paths'))),
},