diff --git a/bundles/backup/files/backup_all b/bundles/backup/files/backup_all index 0befa35..0dbb00f 100644 --- a/bundles/backup/files/backup_all +++ b/bundles/backup/files/backup_all @@ -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" diff --git a/bundles/backup/items.py b/bundles/backup/items.py index 69af814..902e24b 100644 --- a/bundles/backup/items.py +++ b/bundles/backup/items.py @@ -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'))), },