parametrize backup_dir for restoration
Change-Id: I017883719c8e5e7f502828057711e6d44e12b52e
diff --git a/mysql/client/server.sls b/mysql/client/server.sls
index 222def2..c933fc2 100644
--- a/mysql/client/server.sls
+++ b/mysql/client/server.sls
@@ -77,6 +77,7 @@
- defaults:
database_name: {{ database_name }}
database: {{ database }}
+ backup_dir: {{ client.backup_dir }}
- require:
- mysql_database: mysql_{{ server_name }}_database_{{ database_name }}
diff --git a/mysql/conf/restore.sh b/mysql/conf/restore.sh
index 791fa49..9153181 100755
--- a/mysql/conf/restore.sh
+++ b/mysql/conf/restore.sh
@@ -9,7 +9,7 @@
{%- if database.initial_data.source != 'localhost' %}
-scp backupninja@{{ database.initial_data.source }}:/srv/backupninja/{{ host }}{{ path }}mysql.{{ age }}/sqldump/{{ source_name }} /root/mysql/data/{{ source_name }}
+scp backupninja@{{ database.initial_data.source }}:{{ backup_dir }}/{{ host }}{{ path }}mysql.{{ age }}/sqldump/{{ source_name }} /root/mysql/data/{{ source_name }}
gunzip -c /root/mysql/data/{{ source_name }} | mysql -u{{ database.users[0].name }} -p{{ database.users[0].password }} {{ database_name }}
diff --git a/mysql/map.jinja b/mysql/map.jinja
index 1114aef..d372c2c 100644
--- a/mysql/map.jinja
+++ b/mysql/map.jinja
@@ -29,6 +29,7 @@
{%- set client = salt['grains.filter_by']({
'default': {
+ 'backup_dir': '/srv/backupninja'
},
}, merge=salt['pillar.get']('mysql:client')) %}