From 90f6b0a360ae9c0a9b48d4724e138c39646b32bc Mon Sep 17 00:00:00 2001 From: nd <git@notandy.de> Date: Sun, 6 Jun 2021 01:48:48 +0200 Subject: [PATCH] catch non local repos in export --- templates/backup-export.j2 | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/templates/backup-export.j2 b/templates/backup-export.j2 index f9a27dc..3cffe8e 100755 --- a/templates/backup-export.j2 +++ b/templates/backup-export.j2 @@ -4,14 +4,17 @@ set -euo pipefail echo "Starting to export backups..." {% if backup_backend == 'restic' %} -# restic backend -source /etc/backup-client/restic.env - -{% for i in backups.export.destinations if i.type == "rsync" %} -echo "exporting to {{ i.host }}" -rsync -h -r -a --append-verify --delete --stats -e "ssh -p {{ i.port|d(22) }} -i {{ i.key|d('/etc/backup-client/id_ed25519') }}" "${RESTIC_REPOSITORY}/" "{{ i.user }}@{{ i.host }}:{{ i.remotepath }}" -{% endfor %} + # restic backend + source /etc/backup-client/restic.env + {% if backups.backends.restic.repo_type == "local" %} + {% for i in backups.export.destinations if i.type == "rsync" %} + echo "exporting to {{ i.host }}" + rsync -h -r -a --append-verify --delete --stats -e "ssh -p {{ i.port|d(22) }} -i {{ i.key|d('/etc/backup-client/id_ed25519') }}" "${RESTIC_REPOSITORY}/" "{{ i.user }}@{{ i.host }}:{{ i.remotepath }}" + {% endfor %} + {% else %} + echo "Repo is not local. Skipped." + {% endif %} {% endif %} {% if not backup_backend %} -- GitLab