Merge "Add support for backup of Maas DB"
diff --git a/backupninja/client.sls b/backupninja/client.sls
index cacece6..fd0f0bd 100644
--- a/backupninja/client.sls
+++ b/backupninja/client.sls
@@ -20,8 +20,7 @@
- user: root
- group: root
-{%- if pillar.postgresql is defined %}
-
+{%- if pillar.postgresql is defined or pillar.maas is defined %}
backupninja_postgresql_handler:
file.managed:
- name: /etc/backup.d/102.pgsql
diff --git a/backupninja/files/handler/pgsql.conf b/backupninja/files/handler/pgsql.conf
index f934695..58dadb6 100644
--- a/backupninja/files/handler/pgsql.conf
+++ b/backupninja/files/handler/pgsql.conf
@@ -7,8 +7,13 @@
backupdir = /var/backups/postgresql
# where to dump the backups
+{%- if pillar.maas is defined %}
+{%- from "maas/map.jinja" import region with context %}
+databases = {{ region.database.name }}
+{%- else %}
+databases = {% for db_name, db in pillar.postgresql.server.get('database', {}).iteritems() %} {{ db_name }}{% endfor %}
+{%- endif %}
-databases = {% for db in pillar.postgresql.server.get('databases', []) %} {{ db.name }}{% endfor %} {% for db_name, db in pillar.postgresql.server.get('database', {}).iteritems() %} {{ db_name }}{% endfor %}
# which databases to backup. should either be the word 'all' or a
# space separated list of database names.
# Note: when using 'all', pg_dumpall is used instead of pg_dump, which means