Skip to content

Commit

Permalink
parametrize restore backup_dir
Browse files Browse the repository at this point in the history
PROD-20195

Change-Id: Iee5811f3e83259bdd209b0e59641261bccbed6f6
  • Loading branch information
jiribroulik committed May 24, 2018
1 parent f44f108 commit 0052f1a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions maas/files/restore.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{%- from "maas/map.jinja" import region with context %}

{%- set database = region.get("database", {}) %}
{%- set backup_dir = pillar.get('backupninja', {}).get('client', {}).get('target', {}).get("home_dir", "/srv/backupninja") -%}
{%- set database = region.get("database", {}) -%}

export PGHOST={{ database.get("host", "localhost") }}
export PGUSER={{ database.get("username", "maas") }}
Expand All @@ -18,11 +19,11 @@ export PGPASSFILE=/root/.pgpass

mkdir -p {{ target }}

scp backupninja@{{ backupninja_host }}:/srv/backupninja/{{ backupninja_source }}/var/backups/postgresql/postgresql.{{ age }}/{{ source_name }} {{ target }}{{ dest_name }}
scp backupninja@{{ backupninja_host }}:{{ backup_dir }}/{{ backupninja_source }}/var/backups/postgresql/postgresql.{{ age }}/{{ source_name }} {{ target }}{{ dest_name }}
gunzip -d -1 -f {{ target }}{{ dest_name }}

scp -r backupninja@{{ backupninja_host }}:/srv/backupninja/{{ backupninja_source }}/etc/maas/maas.{{ age }} /etc/maas
scp -r backupninja@{{ backupninja_host }}:/srv/backupninja/{{ backupninja_source }}/var/lib/maas/maas.{{ age }} /var/lib/maas
scp -r backupninja@{{ backupninja_host }}:{{ backup_dir }}/{{ backupninja_source }}/etc/maas/maas.{{ age }} /etc/maas
scp -r backupninja@{{ backupninja_host }}:{{ backup_dir }}/{{ backupninja_source }}/var/lib/maas/maas.{{ age }} /var/lib/maas

sudo systemctl stop maas-dhcpd.service
sudo systemctl stop maas-rackd.service
Expand Down

0 comments on commit 0052f1a

Please sign in to comment.