restore dbs pipeline fixes

Change-Id: Id749c53c059737fa95d799d774f3fa94b402f084
diff --git a/xtrabackup-restore-mysql-db.groovy b/xtrabackup-restore-mysql-db.groovy
index 6c8b379..c363ce2 100644
--- a/xtrabackup-restore-mysql-db.groovy
+++ b/xtrabackup-restore-mysql-db.groovy
@@ -43,21 +43,21 @@
                 common.warningMsg('Files are not present')
             }
             try {
-                salt.cmdRun(saltMaster, 'I@galera:master', "mkdir /root/mysql/mysql.bak")
+                salt.cmdRun(saltMaster, 'I@galera:master', "mkdir -p /root/mysql/mysql.bak")
             } catch (Exception er) {
                 common.warningMsg('Directory already exists')
             }
             try {
-                salt.cmdRun(saltMaster, 'I@galera:master', "rm -rf /root/mysql/mysql.bak/*")
-            } catch (Exception er) {
-                common.warningMsg('Directory already empty')
-            }
-            try {
                 salt.cmdRun(saltMaster, 'I@galera:master', "mv /var/lib/mysql/* /root/mysql/mysql.bak")
             } catch (Exception er) {
                 common.warningMsg('Files were already moved')
             }
             try {
+                salt.cmdRun(saltMaster, 'I@galera:master', "rm -rf /var/lib/mysql/*")
+            } catch (Exception er) {
+                common.warningMsg('Directory already empty')
+            }
+            try {
                 salt.runSaltProcessStep(saltMaster, 'I@galera:master', 'file.remove', ["/var/lib/mysql/.galera_bootstrap"], null, true)
             } catch (Exception er) {
                 common.warningMsg('File is not present')