mirror of
https://github.com/rancher/os.git
synced 2025-07-16 16:11:03 +00:00
Rename stage to save for install cli args
This commit is contained in:
parent
4841467d41
commit
a8cf965b2a
@ -86,8 +86,8 @@ var installCommand = cli.Command{
|
|||||||
Usage: "reboot using kexec",
|
Usage: "reboot using kexec",
|
||||||
},
|
},
|
||||||
cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "stage, s",
|
Name: "save, s",
|
||||||
Usage: "stage services",
|
Usage: "save services and images for next booting",
|
||||||
},
|
},
|
||||||
cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "debug",
|
Name: "debug",
|
||||||
@ -179,13 +179,13 @@ func installAction(c *cli.Context) error {
|
|||||||
cloudConfig = uc
|
cloudConfig = uc
|
||||||
}
|
}
|
||||||
|
|
||||||
stageImages := []string{}
|
savedImages := []string{}
|
||||||
if c.Bool("stage") && cloudConfig != "" && installType != "upgrade" {
|
if c.Bool("save") && cloudConfig != "" && installType != "upgrade" {
|
||||||
stageImages = install.GetCacheImageList(cloudConfig, cfg)
|
savedImages = install.GetCacheImageList(cloudConfig, cfg)
|
||||||
log.Debugf("Will cache these images: %s", stageImages)
|
log.Debugf("Will cache these images: %s", savedImages)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := runInstall(image, installType, cloudConfig, device, partition, statedir, kappend, force, kexec, isoinstallerloaded, debug, stageImages); err != nil {
|
if err := runInstall(image, installType, cloudConfig, device, partition, statedir, kappend, force, kexec, isoinstallerloaded, debug, savedImages); err != nil {
|
||||||
log.WithFields(log.Fields{"err": err}).Fatal("Failed to run install")
|
log.WithFields(log.Fields{"err": err}).Fatal("Failed to run install")
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -198,7 +198,7 @@ func installAction(c *cli.Context) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func runInstall(image, installType, cloudConfig, device, partition, statedir, kappend string, force, kexec, isoinstallerloaded, debug bool, stageImages []string) error {
|
func runInstall(image, installType, cloudConfig, device, partition, statedir, kappend string, force, kexec, isoinstallerloaded, debug bool, savedImages []string) error {
|
||||||
fmt.Printf("Installing from %s\n", image)
|
fmt.Printf("Installing from %s\n", image)
|
||||||
|
|
||||||
if !force {
|
if !force {
|
||||||
@ -283,8 +283,8 @@ func runInstall(image, installType, cloudConfig, device, partition, statedir, ka
|
|||||||
if statedir != "" {
|
if statedir != "" {
|
||||||
installerCmd = append(installerCmd, "--statedir", statedir)
|
installerCmd = append(installerCmd, "--statedir", statedir)
|
||||||
}
|
}
|
||||||
if len(stageImages) > 0 {
|
if len(savedImages) > 0 {
|
||||||
installerCmd = append(installerCmd, "--stage")
|
installerCmd = append(installerCmd, "--save")
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: mount at /mnt for shared mount?
|
// TODO: mount at /mnt for shared mount?
|
||||||
@ -348,8 +348,8 @@ func runInstall(image, installType, cloudConfig, device, partition, statedir, ka
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(stageImages) > 0 {
|
if len(savedImages) > 0 {
|
||||||
return install.RunCacheScript(partition, stageImages)
|
return install.RunCacheScript(partition, savedImages)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -18,21 +18,21 @@ type ImageConfig struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GetCacheImageList(cloudconfig string, oldcfg *config.CloudConfig) []string {
|
func GetCacheImageList(cloudconfig string, oldcfg *config.CloudConfig) []string {
|
||||||
stageImages := make([]string, 0)
|
savedImages := make([]string, 0)
|
||||||
bytes, err := readConfigFile(cloudconfig)
|
bytes, err := readConfigFile(cloudconfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.WithFields(log.Fields{"err": err}).Fatal("Failed to read cloud-config")
|
log.WithFields(log.Fields{"err": err}).Fatal("Failed to read cloud-config")
|
||||||
return stageImages
|
return savedImages
|
||||||
}
|
}
|
||||||
r := make(map[interface{}]interface{})
|
r := make(map[interface{}]interface{})
|
||||||
if err := yaml.Unmarshal(bytes, &r); err != nil {
|
if err := yaml.Unmarshal(bytes, &r); err != nil {
|
||||||
log.WithFields(log.Fields{"err": err}).Fatal("Failed to unmarshal cloud-config")
|
log.WithFields(log.Fields{"err": err}).Fatal("Failed to unmarshal cloud-config")
|
||||||
return stageImages
|
return savedImages
|
||||||
}
|
}
|
||||||
newcfg := &config.CloudConfig{}
|
newcfg := &config.CloudConfig{}
|
||||||
if err := util.Convert(r, newcfg); err != nil {
|
if err := util.Convert(r, newcfg); err != nil {
|
||||||
log.WithFields(log.Fields{"err": err}).Fatal("Failed to convert cloud-config")
|
log.WithFields(log.Fields{"err": err}).Fatal("Failed to convert cloud-config")
|
||||||
return stageImages
|
return savedImages
|
||||||
}
|
}
|
||||||
|
|
||||||
// services_include
|
// services_include
|
||||||
@ -40,7 +40,7 @@ func GetCacheImageList(cloudconfig string, oldcfg *config.CloudConfig) []string
|
|||||||
if value {
|
if value {
|
||||||
serviceImage := getServiceImage(key, "", oldcfg, newcfg)
|
serviceImage := getServiceImage(key, "", oldcfg, newcfg)
|
||||||
if serviceImage != "" {
|
if serviceImage != "" {
|
||||||
stageImages = append(stageImages, serviceImage)
|
savedImages = append(savedImages, serviceImage)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -50,7 +50,7 @@ func GetCacheImageList(cloudconfig string, oldcfg *config.CloudConfig) []string
|
|||||||
if newConsole != "" && newConsole != "default" {
|
if newConsole != "" && newConsole != "default" {
|
||||||
consoleImage := getServiceImage(newConsole, "console", oldcfg, newcfg)
|
consoleImage := getServiceImage(newConsole, "console", oldcfg, newcfg)
|
||||||
if consoleImage != "" {
|
if consoleImage != "" {
|
||||||
stageImages = append(stageImages, consoleImage)
|
savedImages = append(savedImages, consoleImage)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,12 +59,12 @@ func GetCacheImageList(cloudconfig string, oldcfg *config.CloudConfig) []string
|
|||||||
if newEngine != "" && newEngine != oldcfg.Rancher.Docker.Engine {
|
if newEngine != "" && newEngine != oldcfg.Rancher.Docker.Engine {
|
||||||
engineImage := getServiceImage(newEngine, "docker", oldcfg, newcfg)
|
engineImage := getServiceImage(newEngine, "docker", oldcfg, newcfg)
|
||||||
if engineImage != "" {
|
if engineImage != "" {
|
||||||
stageImages = append(stageImages, engineImage)
|
savedImages = append(savedImages, engineImage)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return stageImages
|
return savedImages
|
||||||
}
|
}
|
||||||
|
|
||||||
func getServiceImage(service, svctype string, oldcfg, newcfg *config.CloudConfig) string {
|
func getServiceImage(service, svctype string, oldcfg, newcfg *config.CloudConfig) string {
|
||||||
|
Loading…
Reference in New Issue
Block a user