mirror of
https://github.com/rancher/os.git
synced 2025-09-01 23:04:41 +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:
@@ -127,14 +127,19 @@ func installAction(c *cli.Context) error {
|
|||||||
cloudConfig = uc
|
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")
|
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
|
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)
|
fmt.Printf("Installing from %s\n", image)
|
||||||
|
|
||||||
if !force {
|
if !force {
|
||||||
@@ -227,12 +232,10 @@ func runInstall(image, installType, cloudConfig, device, kappend string, force,
|
|||||||
"-d", device,
|
"-d", device,
|
||||||
"-i", image, // TODO: this isn't used - I'm just using it to over-ride the defaulting
|
"-i", image, // TODO: this isn't used - I'm just using it to over-ride the defaulting
|
||||||
}
|
}
|
||||||
if force {
|
// Need to call the inner container with force - the outer one does the "are you sure"
|
||||||
installerCmd = append(installerCmd, "-f")
|
installerCmd = append(installerCmd, "-f")
|
||||||
}
|
// The outer container does the reboot (if needed)
|
||||||
if !reboot {
|
|
||||||
installerCmd = append(installerCmd, "--no-reboot")
|
installerCmd = append(installerCmd, "--no-reboot")
|
||||||
}
|
|
||||||
if cloudConfig != "" {
|
if cloudConfig != "" {
|
||||||
installerCmd = append(installerCmd, "-c", cloudConfig)
|
installerCmd = append(installerCmd, "-c", cloudConfig)
|
||||||
}
|
}
|
||||||
@@ -304,11 +307,6 @@ func runInstall(image, installType, cloudConfig, device, kappend string, force,
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if !kexec && reboot && (force || yes("Continue with reboot")) {
|
|
||||||
log.Info("Rebooting")
|
|
||||||
power.Reboot()
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
1
log/log.go
Normal file → Executable file
1
log/log.go
Normal file → Executable file
@@ -140,5 +140,4 @@ func InitLogger() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
thisLog.Debugf("START: %v in %s", os.Args, pwd)
|
thisLog.Debugf("START: %v in %s", os.Args, pwd)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,3 +1,5 @@
|
|||||||
|
runcmd:
|
||||||
|
- [ sudo, dmesg, --console-off ]
|
||||||
rancher:
|
rancher:
|
||||||
environment:
|
environment:
|
||||||
VERSION: {{.VERSION}}
|
VERSION: {{.VERSION}}
|
||||||
|
4
tests/installer_test.go
Normal file → Executable file
4
tests/installer_test.go
Normal file → Executable file
@@ -8,10 +8,12 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (s *QemuSuite) TestInstallMsDosMbr(c *C) {
|
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{
|
runArgs := []string{
|
||||||
"--iso",
|
"--iso",
|
||||||
"--fresh",
|
"--fresh",
|
||||||
|
"--cloud-config",
|
||||||
|
"./tests/assets/test_17/cloud-config.yml",
|
||||||
}
|
}
|
||||||
version := ""
|
version := ""
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user