Fix input message for stageWrapper to work with ineractive flag
Make sure input is called only in interactive mode.
Change-Id: If8184fc8eb9aae1e074876d33396a2e55a0d59d8
diff --git a/src/com/mirantis/mk/Common.groovy b/src/com/mirantis/mk/Common.groovy
index 6e90c7a..177f546 100644
--- a/src/com/mirantis/mk/Common.groovy
+++ b/src/com/mirantis/mk/Common.groovy
@@ -782,22 +782,24 @@
printCurrentStage(stageMap, currentStage)
stage(currentStage) {
+ if (interactive){
input message: getColorizedString("We are going to execute stage \'${currentStage}\' on the following target ${target}.\nPlease review stage information above.", "yellow")
- try {
- return body.call()
- stageMap[currentStage]['Status'] = "SUCCESS"
- } catch (Exception err) {
- def msg = "Stage ${currentStage} failed with the following exception:\n${err}"
- print getColorizedString(msg, "yellow")
- common.errorMsg(err)
- if (interactive) {
- input message: getColorizedString("Please make sure problem is fixed to proceed with retry. Ready to proceed?", "yellow")
- stageMap[currentStage]['Status'] = "RETRYING"
- stageWrapper(stageMap, currentStage, target, interactive, body)
- } else {
- error(msg)
- }
+ }
+ try {
+ return body.call()
+ stageMap[currentStage]['Status'] = "SUCCESS"
+ } catch (Exception err) {
+ def msg = "Stage ${currentStage} failed with the following exception:\n${err}"
+ print getColorizedString(msg, "yellow")
+ common.errorMsg(err)
+ if (interactive) {
+ input message: getColorizedString("Please make sure problem is fixed to proceed with retry. Ready to proceed?", "yellow")
+ stageMap[currentStage]['Status'] = "RETRYING"
+ stageWrapper(stageMap, currentStage, target, interactive, body)
+ } else {
+ error(msg)
}
+ }
}
}