From 82ec567d5218e280f0e8911972f8dd1813d3abeb Mon Sep 17 00:00:00 2001 From: Josh Curl Date: Sat, 27 Feb 2016 09:00:50 -0800 Subject: [PATCH] Warn if upgrading to the currently running version --- cmd/control/os.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/cmd/control/os.go b/cmd/control/os.go index b02ffd28..2f59e4a5 100644 --- a/cmd/control/os.go +++ b/cmd/control/os.go @@ -193,10 +193,15 @@ func startUpgradeContainer(image string, stage, force, reboot bool) error { } if !stage { - fmt.Printf("Upgrading to %s\n", image) + imageSplit := strings.Split(image, ":") + if len(imageSplit) > 1 && imageSplit[1] == config.VERSION { + if !force && !yes(in, fmt.Sprintf("Already at version %s. Continue anyways", imageSplit[1])) { + os.Exit(1) + } + } else { + fmt.Printf("Upgrading to %s\n", image) - if !force { - if !yes(in, "Continue") { + if !force && !yes(in, "Continue") { os.Exit(1) } }