PROD-29141 Fix in option for galera restore
Change-Id: I89c59335baf96bf71d9927c845569d5a651cf3bc
diff --git a/galera-cluster-verify-restore.groovy b/galera-cluster-verify-restore.groovy
index 7a63858..4c1d63a 100644
--- a/galera-cluster-verify-restore.groovy
+++ b/galera-cluster-verify-restore.groovy
@@ -13,11 +13,11 @@
def salt = new com.mirantis.mk.Salt()
def openstack = new com.mirantis.mk.Openstack()
def python = new com.mirantis.mk.Python()
-
def pepperEnv = "pepperEnv"
def resultCode = 99
askConfirmation = (env.getProperty('ASK_CONFIRMATION') ?: true).toBoolean()
+
if (common.validInputParam(VERIFICATION_RETRIES) && VERIFICATION_RETRIES.isInteger()) {
verificationRetries = VERIFICATION_RETRIES.toInteger()
} else {
@@ -46,15 +46,31 @@
}
}
if (resultCode == 1) {
- common.warningMsg("There was a problem with parsing the status output or with determining it. Do you want to run a restore?")
+ if(askConfirmation){
+ common.warningMsg("There was a problem with parsing the status output or with determining it. Do you want to run a restore?")
+ } else {
+ common.warningMsg("There was a problem with parsing the status output or with determining it. Try to restore.")
+ }
} else if (resultCode > 1) {
- common.warningMsg("There's something wrong with the cluster, do you want to run a restore?")
+ if(askConfirmation){
+ common.warningMsg("There's something wrong with the cluster, do you want to run a restore?")
+ } else {
+ common.warningMsg("There's something wrong with the cluster, try to restore.")
+ }
} else {
- common.warningMsg("There seems to be everything alright with the cluster, do you still want to run a restore?")
+ if(askConfirmation){
+ common.warningMsg("There seems to be everything alright with the cluster, do you still want to run a restore?")
+ } else {
+ common.warningMsg("There seems to be everything alright with the cluster, do nothing")
+ }
}
- input message: "Are you sure you want to run a restore? Click to confirm"
+ if(askConfirmation){
+ input message: "Are you sure you want to run a restore? Click to confirm"
+ }
try {
- openstack.restoreGaleraDb(pepperEnv)
+ if((!askConfirmation && resultCode > 0) || askConfirmation){
+ openstack.restoreGaleraDb(pepperEnv)
+ }
} catch (Exception e) {
common.errorMsg("Restoration process has failed.")
}