Fix qpress binary-dep. processing

Change-Id: Id3e4003be2ba9a31c9653da236f4bc98f1f1175b
Related-Bug: PROD-21980 (PROD:21980)
diff --git a/README.rst b/README.rst
index d34e14e..cffadc8 100644
--- a/README.rst
+++ b/README.rst
@@ -214,7 +214,7 @@
    db from the last full backup and its increments. 2 would mean to
    restore second latest full backup and its increments
 
-Client restore from remote backups: 
+Client restore from remote backups:
 
 .. code-block:: yaml
 
diff --git a/xtrabackup/files/innobackupex-client-restore.sh b/xtrabackup/files/innobackupex-client-restore.sh
index 4ac3e81..abd08c2 100644
--- a/xtrabackup/files/innobackupex-client-restore.sh
+++ b/xtrabackup/files/innobackupex-client-restore.sh
@@ -135,8 +135,6 @@
         cp qpress  /usr/bin/qpress
         chmod 755 /usr/bin/qpress
         chown root:root /usr/bin/qpress
-{%- elif client.qpress.source == 'pkg' %}
-        apt install {{ client.qpress.name }} > $decompressionLog 2>&1
 {%- endif %}
     fi
     echo "Uncompressing $FULLBACKUP"
@@ -168,8 +166,6 @@
           cp qpress  /usr/bin/qpress
           chmod 755 /usr/bin/qpress
           chown root:root /usr/bin/qpress
-{%- elif client.qpress.source == 'pkg' %}
-          apt install {{ client.qpress.name }} > $decompressionLog 2>&1
 {%- endif %}
       fi
       echo "Uncompressing $FULLBACKUP"
@@ -218,3 +214,6 @@
 echo
 echo "completed: `date`"
 exit 0
+{#
+# vim: ft=jinja
+#}
diff --git a/xtrabackup/map.jinja b/xtrabackup/map.jinja
index 2cd5203..f078f74 100644
--- a/xtrabackup/map.jinja
+++ b/xtrabackup/map.jinja
@@ -1,28 +1,33 @@
-

-{% set client = salt['grains.filter_by']({

-  'Debian': {

-    'pkgs': ['percona-xtrabackup'],

-    'cron': True,

-    'backup_dir': '/var/backups/mysql/xtrabackup'

-  },

-  'RedHat': {

-    'pkgs': ['percona-xtrabackup'],

-    'cron': True,

-    'backup_dir': '/var/backups/mysql/xtrabackup'

-  },

-}, merge=salt['pillar.get']('xtrabackup:client')) %}

-

-{% set server = salt['grains.filter_by']({

-  'Debian': {

-    'pkgs': ['rsync'],

-    'cron': True,

-    'restrict_clients': True,

-    'backup_dir': '/var/backups/mysql/xtrabackup'

-  },

-  'RedHat': {

-    'pkgs': ['rsync'],

-    'cron': True,

-    'restrict_clients': True,

-    'backup_dir': '/var/backups/mysql/xtrabackup'

-  },

-}, merge=salt['pillar.get']('xtrabackup:server')) %}

+{%- if salt['pillar.get']('xtrabackup:client:qpress:source') == 'pkg' %}
+  {% set client_pkgs_list = ['percona-xtrabackup', 'qpress'] %}
+{%- else %}
+  {% set client_pkgs_list = ['percona-xtrabackup' ] %}
+{%- endif %}
+
+{% set client = salt['grains.filter_by']({
+  'Debian': {
+    'pkgs': client_pkgs_list,
+    'cron': True,
+    'backup_dir': '/var/backups/mysql/xtrabackup'
+  },
+  'RedHat': {
+    'pkgs': client_pkgs_list,
+    'cron': True,
+    'backup_dir': '/var/backups/mysql/xtrabackup'
+  },
+}, merge=salt['pillar.get']('xtrabackup:client')) %}
+
+{% set server = salt['grains.filter_by']({
+  'Debian': {
+    'pkgs': ['rsync'],
+    'cron': True,
+    'restrict_clients': True,
+    'backup_dir': '/var/backups/mysql/xtrabackup'
+  },
+  'RedHat': {
+    'pkgs': ['rsync'],
+    'cron': True,
+    'restrict_clients': True,
+    'backup_dir': '/var/backups/mysql/xtrabackup'
+  },
+}, merge=salt['pillar.get']('xtrabackup:server')) %}