Skip to content

Commit

Permalink
Use mustConfirm helper for rollback confirmation
Browse files Browse the repository at this point in the history
  • Loading branch information
Nosajool committed Aug 18, 2016
1 parent c60b0da commit 3e2bba8
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions cmd/emp/releases.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,14 +249,7 @@ func rollbackSafetyCheck(verStr, appname string) {

diff := currVer - verNum
if diff >= 10 {
var vconfirmation string
fmt.Printf("WARNING. Attempting to rollback %d versions from v%d to v%d.\n", diff, currVer, verNum)
fmt.Printf("To proceed, type v%d: ", verNum)
fmt.Scanln(&vconfirmation)
vconfirmation = strings.TrimPrefix(vconfirmation, "v")
if vconfirmation != verStr {
fmt.Println("Rollback confirmation did not match.")
os.Exit(2)
}
warning := fmt.Sprintf("Attempting to rollback %d versions from v%d to v%d. Type v%d to continue:", diff, currVer, verNum, verNum)
mustConfirm(warning, fmt.Sprintf("v%s", verStr))
}
}

0 comments on commit 3e2bba8

Please sign in to comment.