mirror of
https://github.com/kairos-io/kairos-agent.git
synced 2025-09-08 12:29:27 +00:00
Add recovery upgrade flag to upgrade command + msg (#123)
This commit is contained in:
@@ -50,7 +50,7 @@ func ListReleases(includePrereleases bool) semver.Collection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func Upgrade(
|
func Upgrade(
|
||||||
version, source string, force, strictValidations bool, dirs []string, preReleases bool) error {
|
version, source string, force, strictValidations bool, dirs []string, preReleases, upgradeRecovery bool) error {
|
||||||
bus.Manager.Initialize()
|
bus.Manager.Initialize()
|
||||||
|
|
||||||
if version == "" && source == "" {
|
if version == "" && source == "" {
|
||||||
@@ -111,6 +111,9 @@ func Upgrade(
|
|||||||
}
|
}
|
||||||
upgradeSpec.Active.Source = imgSource
|
upgradeSpec.Active.Source = imgSource
|
||||||
|
|
||||||
|
// Set the recovery upgrade flag to upgrade recovery or active
|
||||||
|
upgradeSpec.RecoveryUpgrade = upgradeRecovery
|
||||||
|
|
||||||
// Sanitize
|
// Sanitize
|
||||||
err = upgradeSpec.Sanitize()
|
err = upgradeSpec.Sanitize()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
6
main.go
6
main.go
@@ -69,9 +69,10 @@ var cmds = []*cli.Command{
|
|||||||
Usage: "Source for upgrade. Composed of `type:address`. Accepts `file:`,`dir:` or `oci:` for the type of source.\nFor example `file:/var/share/myimage.tar`, `dir:/tmp/extracted` or `oci:repo/image:tag`",
|
Usage: "Source for upgrade. Composed of `type:address`. Accepts `file:`,`dir:` or `oci:` for the type of source.\nFor example `file:/var/share/myimage.tar`, `dir:/tmp/extracted` or `oci:repo/image:tag`",
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{Name: "pre", Usage: "Include pre-releases (rc, beta, alpha)"},
|
&cli.BoolFlag{Name: "pre", Usage: "Include pre-releases (rc, beta, alpha)"},
|
||||||
|
&cli.BoolFlag{Name: "recovery", Usage: "Upgrade recovery"},
|
||||||
},
|
},
|
||||||
Description: `
|
Description: `
|
||||||
Manually upgrade a kairos node.
|
Manually upgrade a kairos node Active image. Does not upgrade passive or recovery images.
|
||||||
|
|
||||||
By default takes no arguments, defaulting to latest available release, to specify a version, pass it as argument:
|
By default takes no arguments, defaulting to latest available release, to specify a version, pass it as argument:
|
||||||
|
|
||||||
@@ -137,11 +138,10 @@ See https://kairos.io/docs/upgrade/manual/ for documentation.
|
|||||||
return agent.Upgrade(
|
return agent.Upgrade(
|
||||||
v, source, c.Bool("force"),
|
v, source, c.Bool("force"),
|
||||||
c.Bool("strict-validation"), configScanDir,
|
c.Bool("strict-validation"), configScanDir,
|
||||||
c.Bool("pre"),
|
c.Bool("pre"), c.Bool("recovery"),
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
Name: "notify",
|
Name: "notify",
|
||||||
Usage: "notify <event> <config dir>...",
|
Usage: "notify <event> <config dir>...",
|
||||||
|
@@ -274,6 +274,10 @@ func (u *UpgradeAction) Run() (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
u.Info("Upgrade completed")
|
u.Info("Upgrade completed")
|
||||||
|
if !u.spec.RecoveryUpgrade {
|
||||||
|
u.config.Logger.Warn("Remember that recovery is upgraded separately by passing the --recovery flag to the upgrade command!\n" +
|
||||||
|
"See more info about this on https://kairos.io/docs/upgrade/")
|
||||||
|
}
|
||||||
|
|
||||||
// Do not reboot/poweroff on cleanup errors
|
// Do not reboot/poweroff on cleanup errors
|
||||||
if cleanErr := cleanup.Cleanup(err); cleanErr != nil {
|
if cleanErr := cleanup.Cleanup(err); cleanErr != nil {
|
||||||
|
Reference in New Issue
Block a user