1
0
mirror of https://github.com/rancher/os.git synced 2025-09-15 22:49:08 +00:00

Merge pull request #1316 from SvenDowideit/refactor-yes

Moved NewReader into yes(prompt)
This commit is contained in:
Sven Dowideit
2016-10-21 13:48:19 -07:00
committed by GitHub
4 changed files with 12 additions and 19 deletions

View File

@@ -1,7 +1,6 @@
package control
import (
"bufio"
"fmt"
"io/ioutil"
"net/http"
@@ -196,8 +195,6 @@ func osVersion(c *cli.Context) error {
}
func startUpgradeContainer(image string, stage, force, reboot, kexec bool, upgradeConsole bool, kernelArgs string) error {
in := bufio.NewReader(os.Stdin)
command := []string{
"-t", "rancher-upgrade",
"-r", config.VERSION,
@@ -224,7 +221,7 @@ func startUpgradeContainer(image string, stage, force, reboot, kexec bool, upgra
if len(imageSplit) > 1 && imageSplit[1] == config.VERSION+config.SUFFIX {
confirmation = fmt.Sprintf("Already at version %s. Continue anyway", imageSplit[1])
}
if !force && !yes(in, confirmation) {
if !force && !yes(confirmation) {
os.Exit(1)
}
@@ -274,7 +271,7 @@ func startUpgradeContainer(image string, stage, force, reboot, kexec bool, upgra
return err
}
if reboot && (force || yes(in, "Continue with reboot")) {
if reboot && (force || yes("Continue with reboot")) {
log.Info("Rebooting")
power.Reboot()
}