1
0
mirror of https://github.com/rancher/os.git synced 2025-09-25 04:37:02 +00:00

Add debug to upgrade to track down why the global.cfg isn't persisting

Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
This commit is contained in:
Sven Dowideit
2017-04-21 15:16:51 +00:00
parent 56ac7f1f87
commit a21c414ce1
3 changed files with 53 additions and 3 deletions

View File

@@ -939,6 +939,7 @@ func upgradeBootloader(device, baseName, bootDir, diskType string) error {
for _, line := range lines {
line = strings.TrimSpace(line)
if strings.HasPrefix(line, "APPEND") {
log.Errorf("write new (%s) %s", filepath.Join(baseName, bootDir, "global.cfg"), err)
// TODO: need to append any extra's the user specified
ioutil.WriteFile(filepath.Join(baseName, bootDir, "global.cfg"), []byte(cfg), 0644)
break

View File

@@ -64,6 +64,10 @@ func osSubcommands() []cli.Command {
Name: "upgrade-console",
Usage: "upgrade console even if persistent",
},
cli.BoolFlag{
Name: "debug",
Usage: "Run installer with debug output",
},
},
},
{
@@ -187,7 +191,16 @@ func osUpgrade(c *cli.Context) error {
if c.Args().Present() {
log.Fatalf("invalid arguments %v", c.Args())
}
if err := startUpgradeContainer(image, c.Bool("stage"), c.Bool("force"), !c.Bool("no-reboot"), c.Bool("kexec"), c.Bool("upgrade-console"), c.String("append")); err != nil {
if err := startUpgradeContainer(
image,
c.Bool("stage"),
c.Bool("force"),
!c.Bool("no-reboot"),
c.Bool("kexec"),
c.Bool("upgrade-console"),
c.Bool("debug"),
c.String("append"),
); err != nil {
log.Fatal(err)
}
@@ -199,7 +212,7 @@ func osVersion(c *cli.Context) error {
return nil
}
func startUpgradeContainer(image string, stage, force, reboot, kexec bool, upgradeConsole bool, kernelArgs string) error {
func startUpgradeContainer(image string, stage, force, reboot, kexec, debug bool, upgradeConsole bool, kernelArgs string) error {
command := []string{
"-t", "rancher-upgrade",
"-r", config.Version,
@@ -208,6 +221,9 @@ func startUpgradeContainer(image string, stage, force, reboot, kexec bool, upgra
if kexec {
command = append(command, "--kexec")
}
if debug {
command = append(command, "--debug")
}
kernelArgs = strings.TrimSpace(kernelArgs)
if kernelArgs != "" {