mirror of
https://github.com/rancher/os.git
synced 2025-09-25 04:37:02 +00:00
add upgrade with non-default console installed
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
This commit is contained in:
@@ -220,7 +220,7 @@ func runInstall(image, installType, cloudConfig, device, kappend string, force,
|
||||
if !isoinstallerloaded {
|
||||
log.Infof("start !isoinstallerloaded")
|
||||
|
||||
if _, err := os.Stat("/dist/initrd"); os.IsNotExist(err) {
|
||||
if _, err := os.Stat("/dist/initrd-" + config.Version); os.IsNotExist(err) {
|
||||
if err = mountBootIso(); err != nil {
|
||||
log.Debugf("mountBootIso error %s", err)
|
||||
} else {
|
||||
@@ -237,8 +237,11 @@ func runInstall(image, installType, cloudConfig, device, kappend string, force,
|
||||
useIso = true
|
||||
// now use the installer image
|
||||
cfg := config.LoadConfig()
|
||||
// TODO: fix the fullinstaller Dockerfile to use the ${VERSION}${SUFFIX}
|
||||
image = cfg.Rancher.Upgrade.Image + "-installer" + ":latest"
|
||||
|
||||
if image == cfg.Rancher.Upgrade.Image+":"+config.Version+config.Suffix {
|
||||
// TODO: fix the fullinstaller Dockerfile to use the ${VERSION}${SUFFIX}
|
||||
image = cfg.Rancher.Upgrade.Image + "-installer" + ":latest"
|
||||
}
|
||||
}
|
||||
}
|
||||
// TODO: also poke around looking for the /boot/vmlinuz and initrd...
|
||||
|
@@ -185,13 +185,13 @@ func (s *QemuSuite) LoadInstallerImage(c *C) {
|
||||
c.Assert(cmd.Run(), IsNil)
|
||||
}
|
||||
|
||||
func (s *QemuSuite) PullAndLoadInstallerImage(c *C, tag string) {
|
||||
cmd := exec.Command("sh", "-c", fmt.Sprintf("docker pull rancher/os:%s", tag))
|
||||
func (s *QemuSuite) PullAndLoadInstallerImage(c *C, image string) {
|
||||
cmd := exec.Command("sh", "-c", fmt.Sprintf("docker pull %s", image))
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stderr
|
||||
c.Assert(cmd.Run(), IsNil)
|
||||
|
||||
cmd = exec.Command("sh", "-c", fmt.Sprintf("docker save rancher/os:%s | ../scripts/ssh --qemu sudo system-docker load", tag))
|
||||
cmd = exec.Command("sh", "-c", fmt.Sprintf("docker save %s | ../scripts/ssh --qemu sudo system-docker load", image))
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stderr
|
||||
c.Assert(cmd.Run(), IsNil)
|
||||
|
@@ -40,7 +40,9 @@ func (s *QemuSuite) commonTestCode(c *C, startWithVersion, console string) {
|
||||
c.Assert(Version, Equals, version)
|
||||
|
||||
fmt.Printf("installing %s", startWithVersion)
|
||||
s.PullAndLoadInstallerImage(c, startWithVersion)
|
||||
s.PullAndLoadInstallerImage(c, fmt.Sprintf("rancher/os:%s", startWithVersion))
|
||||
|
||||
//ADD a custom append line and make sure its kept in the upgraded version too
|
||||
|
||||
s.CheckCall(c, fmt.Sprintf(`
|
||||
echo "---------------------------------- generic"
|
||||
@@ -48,9 +50,8 @@ set -ex
|
||||
echo "ssh_authorized_keys:" > config.yml
|
||||
echo " - $(cat /home/rancher/.ssh/authorized_keys)" >> config.yml
|
||||
sudo ros install --force --no-reboot --device /dev/vda -c config.yml --append rancher.password=rancher -i rancher/os:%s
|
||||
sudo ros console enable %s
|
||||
sync
|
||||
`, startWithVersion, console))
|
||||
`, startWithVersion))
|
||||
time.Sleep(500 * time.Millisecond)
|
||||
s.Stop(c)
|
||||
}
|
||||
@@ -63,6 +64,15 @@ sync
|
||||
|
||||
s.CheckOutput(c, "ros version "+startWithVersion+"\n", Equals, "sudo ros -v")
|
||||
|
||||
if console != "default" {
|
||||
// Can't preload the startWithVersion console image, as some don't exist by that name - not sure how to approach that
|
||||
//s.PullAndLoadInstallerImage(c, fmt.Sprintf("rancher/os-%sconsole:%s", console, startWithVersion))
|
||||
// TODO: ouch. probably need to tag the dev / master version as latest cos this won't work
|
||||
// Need to pull the image here - if we do it at boot, then the test will fail.
|
||||
s.PullAndLoadInstallerImage(c, fmt.Sprintf("rancher/os-%sconsole:%s", console, "v0.8.0-rc3"))
|
||||
s.CheckCall(c, fmt.Sprintf("sudo ros console enable %s", console))
|
||||
}
|
||||
|
||||
s.LoadInstallerImage(c)
|
||||
s.CheckCall(c, fmt.Sprintf("sudo ros os upgrade --no-reboot -i rancher/os:%s%s --force", Version, Suffix))
|
||||
|
||||
|
Reference in New Issue
Block a user