1
0
mirror of https://github.com/rancher/os.git synced 2025-07-17 08:31:02 +00:00

Merge pull request #784 from joshwget/up-to-date-upgrade-warning

Warn if upgrading to the currently running version
This commit is contained in:
Darren Shepherd 2016-03-31 11:51:52 -07:00
commit e53155d023

View File

@ -212,10 +212,15 @@ func startUpgradeContainer(image string, stage, force, reboot, kexec 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)
}
}