From 1761d770c9b88cd1eb338ad472d4a10b179b5dc9 Mon Sep 17 00:00:00 2001 From: Sven Dowideit Date: Tue, 17 Jan 2017 22:13:35 +1000 Subject: [PATCH 1/2] make yN and reboot happen in the console container, not in the installer sub-container Signed-off-by: Sven Dowideit --- cmd/control/install.go | 24 +++++++++++------------- tests/installer_test.go | 4 +++- 2 files changed, 14 insertions(+), 14 deletions(-) mode change 100644 => 100755 tests/installer_test.go 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/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 := "" { From 2980684ae03741ba62a9aebd656eb2da8c714e09 Mon Sep 17 00:00:00 2001 From: Sven Dowideit Date: Tue, 17 Jan 2017 22:31:55 +1000 Subject: [PATCH 2/2] disable the DEBUG log spewing to console once the console is up - from there, its in dmesg Signed-off-by: Sven Dowideit --- log/log.go | 1 - os-config.tpl.yml | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) mode change 100644 => 100755 log/log.go 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}}