Skip to content
This repository was archived by the owner on Oct 11, 2023. It is now read-only.

Commit a8cf965

Browse files
committed
Rename stage to save for install cli args
1 parent 4841467 commit a8cf965

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

cmd/control/install.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ var installCommand = cli.Command{
8686
Usage: "reboot using kexec",
8787
},
8888
cli.BoolFlag{
89-
Name: "stage, s",
90-
Usage: "stage services",
89+
Name: "save, s",
90+
Usage: "save services and images for next booting",
9191
},
9292
cli.BoolFlag{
9393
Name: "debug",
@@ -179,13 +179,13 @@ func installAction(c *cli.Context) error {
179179
cloudConfig = uc
180180
}
181181

182-
stageImages := []string{}
183-
if c.Bool("stage") && cloudConfig != "" && installType != "upgrade" {
184-
stageImages = install.GetCacheImageList(cloudConfig, cfg)
185-
log.Debugf("Will cache these images: %s", stageImages)
182+
savedImages := []string{}
183+
if c.Bool("save") && cloudConfig != "" && installType != "upgrade" {
184+
savedImages = install.GetCacheImageList(cloudConfig, cfg)
185+
log.Debugf("Will cache these images: %s", savedImages)
186186
}
187187

188-
if err := runInstall(image, installType, cloudConfig, device, partition, statedir, kappend, force, kexec, isoinstallerloaded, debug, stageImages); err != nil {
188+
if err := runInstall(image, installType, cloudConfig, device, partition, statedir, kappend, force, kexec, isoinstallerloaded, debug, savedImages); err != nil {
189189
log.WithFields(log.Fields{"err": err}).Fatal("Failed to run install")
190190
return err
191191
}
@@ -198,7 +198,7 @@ func installAction(c *cli.Context) error {
198198
return nil
199199
}
200200

201-
func runInstall(image, installType, cloudConfig, device, partition, statedir, kappend string, force, kexec, isoinstallerloaded, debug bool, stageImages []string) error {
201+
func runInstall(image, installType, cloudConfig, device, partition, statedir, kappend string, force, kexec, isoinstallerloaded, debug bool, savedImages []string) error {
202202
fmt.Printf("Installing from %s\n", image)
203203

204204
if !force {
@@ -283,8 +283,8 @@ func runInstall(image, installType, cloudConfig, device, partition, statedir, ka
283283
if statedir != "" {
284284
installerCmd = append(installerCmd, "--statedir", statedir)
285285
}
286-
if len(stageImages) > 0 {
287-
installerCmd = append(installerCmd, "--stage")
286+
if len(savedImages) > 0 {
287+
installerCmd = append(installerCmd, "--save")
288288
}
289289

290290
// TODO: mount at /mnt for shared mount?
@@ -348,8 +348,8 @@ func runInstall(image, installType, cloudConfig, device, partition, statedir, ka
348348
return err
349349
}
350350

351-
if len(stageImages) > 0 {
352-
return install.RunCacheScript(partition, stageImages)
351+
if len(savedImages) > 0 {
352+
return install.RunCacheScript(partition, savedImages)
353353
}
354354

355355
return nil

cmd/control/install/service.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,29 @@ type ImageConfig struct {
1818
}
1919

2020
func GetCacheImageList(cloudconfig string, oldcfg *config.CloudConfig) []string {
21-
stageImages := make([]string, 0)
21+
savedImages := make([]string, 0)
2222
bytes, err := readConfigFile(cloudconfig)
2323
if err != nil {
2424
log.WithFields(log.Fields{"err": err}).Fatal("Failed to read cloud-config")
25-
return stageImages
25+
return savedImages
2626
}
2727
r := make(map[interface{}]interface{})
2828
if err := yaml.Unmarshal(bytes, &r); err != nil {
2929
log.WithFields(log.Fields{"err": err}).Fatal("Failed to unmarshal cloud-config")
30-
return stageImages
30+
return savedImages
3131
}
3232
newcfg := &config.CloudConfig{}
3333
if err := util.Convert(r, newcfg); err != nil {
3434
log.WithFields(log.Fields{"err": err}).Fatal("Failed to convert cloud-config")
35-
return stageImages
35+
return savedImages
3636
}
3737

3838
// services_include
3939
for key, value := range newcfg.Rancher.ServicesInclude {
4040
if value {
4141
serviceImage := getServiceImage(key, "", oldcfg, newcfg)
4242
if serviceImage != "" {
43-
stageImages = append(stageImages, serviceImage)
43+
savedImages = append(savedImages, serviceImage)
4444
}
4545
}
4646
}
@@ -50,7 +50,7 @@ func GetCacheImageList(cloudconfig string, oldcfg *config.CloudConfig) []string
5050
if newConsole != "" && newConsole != "default" {
5151
consoleImage := getServiceImage(newConsole, "console", oldcfg, newcfg)
5252
if consoleImage != "" {
53-
stageImages = append(stageImages, consoleImage)
53+
savedImages = append(savedImages, consoleImage)
5454
}
5555
}
5656

@@ -59,12 +59,12 @@ func GetCacheImageList(cloudconfig string, oldcfg *config.CloudConfig) []string
5959
if newEngine != "" && newEngine != oldcfg.Rancher.Docker.Engine {
6060
engineImage := getServiceImage(newEngine, "docker", oldcfg, newcfg)
6161
if engineImage != "" {
62-
stageImages = append(stageImages, engineImage)
62+
savedImages = append(savedImages, engineImage)
6363
}
6464

6565
}
6666

67-
return stageImages
67+
return savedImages
6868
}
6969

7070
func getServiceImage(service, svctype string, oldcfg, newcfg *config.CloudConfig) string {

0 commit comments

Comments
 (0)