diff --git a/cmd/control/install.go b/cmd/control/install.go index 31f4cb73..cd438056 100755 --- a/cmd/control/install.go +++ b/cmd/control/install.go @@ -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 } diff --git a/log/log.go b/log/log.go old mode 100644 new mode 100755 index aea5108e..4b905a4d --- a/log/log.go +++ b/log/log.go @@ -140,5 +140,4 @@ func InitLogger() { } thisLog.Debugf("START: %v in %s", os.Args, pwd) - } diff --git a/os-config.tpl.yml b/os-config.tpl.yml index bcf12425..da5ea61e 100644 --- a/os-config.tpl.yml +++ b/os-config.tpl.yml @@ -1,3 +1,5 @@ +runcmd: +- [ sudo, dmesg, --console-off ] rancher: environment: VERSION: {{.VERSION}} diff --git a/tests/installer_test.go b/tests/installer_test.go old mode 100644 new mode 100755 index 81b765e6..bad34b3b --- a/tests/installer_test.go +++ b/tests/installer_test.go @@ -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 := "" {