mirror of
https://github.com/kairos-io/kairos-agent.git
synced 2025-09-17 07:17:41 +00:00
Upgrade to latest release if one is not specified and ask user to confirm (#389)
* Upgrade to latest release if one is not specified and ask user to confirm Signed-off-by: Dimitris Karakasilis <dimitris@karakasilis.me> * Re-use existing promptBool function Signed-off-by: Dimitris Karakasilis <dimitris@karakasilis.me> Signed-off-by: Dimitris Karakasilis <dimitris@karakasilis.me>
This commit is contained in:
committed by
Itxaka
parent
74bf315829
commit
080a34bd9a
@@ -51,8 +51,15 @@ func Upgrade(version, image string, force, debug bool, dirs []string) error {
|
||||
return fmt.Errorf("no releases found")
|
||||
}
|
||||
|
||||
version = releases[0]
|
||||
fmt.Println("latest release is ", version)
|
||||
version = releases[len(releases)-1]
|
||||
msg := fmt.Sprintf("Latest release is %s\nAre you sure you want to upgrade to this release? (y/n)", version)
|
||||
reply, err := promptBool(events.YAMLPrompt{Prompt: msg, Default: "y"})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if reply == "false" {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
if utils.Version() == version && !force {
|
||||
|
Reference in New Issue
Block a user