1
0
mirror of https://github.com/rancher/os.git synced 2025-08-31 06:11:12 +00:00

Merge pull request #1524 from SvenDowideit/fix-installer-reboot

make yN and reboot happen in the console container, not in the instal…
This commit is contained in:
Sven Dowideit
2017-01-17 23:02:13 +10:00
committed by GitHub
4 changed files with 16 additions and 15 deletions

View File

@@ -127,14 +127,19 @@ func installAction(c *cli.Context) error {
cloudConfig = uc
}
if err := runInstall(image, installType, cloudConfig, device, kappend, force, reboot, kexec, isoinstallerloaded); err != nil {
if err := runInstall(image, installType, cloudConfig, device, kappend, force, kexec, isoinstallerloaded); err != nil {
log.WithFields(log.Fields{"err": err}).Fatal("Failed to run install")
}
if !kexec && reboot && (force || yes("Continue with reboot")) {
log.Info("Rebooting")
power.Reboot()
}
return nil
}
func runInstall(image, installType, cloudConfig, device, kappend string, force, reboot, kexec, isoinstallerloaded bool) error {
func runInstall(image, installType, cloudConfig, device, kappend string, force, kexec, isoinstallerloaded bool) error {
fmt.Printf("Installing from %s\n", image)
if !force {
@@ -227,12 +232,10 @@ func runInstall(image, installType, cloudConfig, device, kappend string, force,
"-d", device,
"-i", image, // TODO: this isn't used - I'm just using it to over-ride the defaulting
}
if force {
installerCmd = append(installerCmd, "-f")
}
if !reboot {
installerCmd = append(installerCmd, "--no-reboot")
}
// Need to call the inner container with force - the outer one does the "are you sure"
installerCmd = append(installerCmd, "-f")
// The outer container does the reboot (if needed)
installerCmd = append(installerCmd, "--no-reboot")
if cloudConfig != "" {
installerCmd = append(installerCmd, "-c", cloudConfig)
}
@@ -304,11 +307,6 @@ func runInstall(image, installType, cloudConfig, device, kappend string, force,
return err
}
if !kexec && reboot && (force || yes("Continue with reboot")) {
log.Info("Rebooting")
power.Reboot()
}
return nil
}

1
log/log.go Normal file → Executable file
View File

@@ -140,5 +140,4 @@ func InitLogger() {
}
thisLog.Debugf("START: %v in %s", os.Args, pwd)
}

View File

@@ -1,3 +1,5 @@
runcmd:
- [ sudo, dmesg, --console-off ]
rancher:
environment:
VERSION: {{.VERSION}}

4
tests/installer_test.go Normal file → Executable file
View File

@@ -8,10 +8,12 @@ import (
)
func (s *QemuSuite) TestInstallMsDosMbr(c *C) {
// ./scripts/run --no-format --append "rancher.debug=true" --iso --fresh
// test_17 cloud config is an invalid http proxy cfg, so the installer has no network
runArgs := []string{
"--iso",
"--fresh",
"--cloud-config",
"./tests/assets/test_17/cloud-config.yml",
}
version := ""
{