Call xtrabackup.client.restore to trigger restore
- fix missing imports
- add galera state for slaves as well
Related: PROD-32475
Change-Id: I27b55be424022c5391a8b409e93500117046a632
(cherry picked from commit ef778c39bce59f20d0c9bcd464f6b6a1d13091f3)
diff --git a/src/com/mirantis/mk/Galera.groovy b/src/com/mirantis/mk/Galera.groovy
index d5cdc6e..56468ce 100644
--- a/src/com/mirantis/mk/Galera.groovy
+++ b/src/com/mirantis/mk/Galera.groovy
@@ -356,13 +356,16 @@
* @param targetNode Node to be targeted
*/
def restoreGaleraDb(env, targetNode) {
+ def salt = new com.mirantis.mk.Salt()
def backup_dir = salt.getReturnValues(salt.getPillar(env, targetNode, 'xtrabackup:client:backup_dir'))
if(backup_dir == null || backup_dir.isEmpty()) { backup_dir='/var/backups/mysql/xtrabackup' }
salt.runSaltProcessStep(env, targetNode, 'file.remove', ["${backup_dir}/dbrestored"])
- salt.cmdRun(env, targetNode, "su root -c 'salt-call state.sls xtrabackup.client'")
+ salt.enforceState(['saltId': env, 'target': targetNode, 'state': 'xtrabackup.client'])
+ salt.enforceState(['saltId': env, 'target': targetNode, 'state': 'xtrabackup.client.restore'])
}
def restoreGaleraDb(env) {
+ def common = new com.mirantis.mk.Common()
common.warningMsg("This method was renamed to 'restoreGaleraCluster'. Please change your pipeline to use this call instead! If you think that you really wanted to call 'restoreGaleraDb' you may be missing 'targetNode' parameter in you call.")
return restoreGaleraCluster(env)
}