Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
update rancheros provision
Signed-off-by: JacieChao <kathyyy@163.com>
  • Loading branch information
JacieChao committed May 9, 2018
commit f45cfd0b97c835d3337a5a89855ab45215945168
24 changes: 12 additions & 12 deletions libmachine/provision/rancheros.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ import (
)

const (
versionsURL = "http://releases.rancher.com/os/versions.yml"
isoURL = "https://github.com/rancherio/os/releases/download/%s/machine-rancheros.iso"
hostnameTmpl = `sudo mkdir -p /var/lib/rancher/conf/cloud-config.d/
versionsURL = "https://releases.rancher.com/os/releases.yml"
isoURL = "https://releases.rancher.com/os/%s/rancheros.iso"
hostnameTmpl = `sudo mkdir -p /var/lib/rancher/conf/cloud-config.d/
sudo tee /var/lib/rancher/conf/cloud-config.d/machine-hostname.yml << EOF
#cloud-config

Expand Down Expand Up @@ -75,15 +75,15 @@ func (provisioner *RancherProvisioner) Package(name string, action pkgaction.Pac

switch action {
case pkgaction.Install:
packageAction = "enabled"
packageAction = "enable"
case pkgaction.Remove:
packageAction = "disable"
case pkgaction.Upgrade:
// TODO: support upgrade
packageAction = "upgrade"
}

command := fmt.Sprintf("sudo rancherctl service %s %s", packageAction, name)
command := fmt.Sprintf("sudo ros service %s %s", packageAction, name)

if _, err := provisioner.SSHCommand(command); err != nil {
return err
Expand All @@ -102,7 +102,7 @@ func (provisioner *RancherProvisioner) Provision(swarmOptions swarm.Options, aut

if provisioner.EngineOptions.StorageDriver == "" {
provisioner.EngineOptions.StorageDriver = "overlay"
} else if provisioner.EngineOptions.StorageDriver != "overlay" {
} else if provisioner.EngineOptions.StorageDriver != "overlay" && provisioner.EngineOptions.StorageDriver != "overlay2" {
return fmt.Errorf("Unsupported storage driver: %s", provisioner.EngineOptions.StorageDriver)
}

Expand Down Expand Up @@ -163,7 +163,7 @@ func (provisioner *RancherProvisioner) upgrade() error {
return provisioner.upgradeIso()
default:
log.Infof("Running upgrade")
if _, err := provisioner.SSHCommand("sudo rancherctl os upgrade -f --no-reboot"); err != nil {
if _, err := provisioner.SSHCommand("sudo ros os upgrade -f --no-reboot"); err != nil {
return err
}

Expand Down Expand Up @@ -201,12 +201,12 @@ func (provisioner *RancherProvisioner) upgradeIso() error {
return err
}

if err := b2dutils.DownloadISOFromURL(url); err != nil {
return err
}
//if err := b2dutils.DownloadISOFromURL(url); err != nil {
// return err
//}

// Copy the latest version of boot2docker ISO to the machine's directory
if err := b2dutils.CopyIsoToMachineDir("", machineName); err != nil {
// Copy the latest version of rancheros ISO to the machine's directory
if err := b2dutils.CopyIsoToMachineDir(url, machineName); err != nil {
return err
}

Expand Down
4 changes: 2 additions & 2 deletions test/provision/rancheros.bats
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ if [[ "$DRIVER" != "virtualbox" ]]; then
exit 0
fi

export RANCHEROS_VERSION="v0.3.1"
export RANCHEROS_ISO="https://github.com/rancherio/os/releases/download/$RANCHEROS_VERSION/machine-rancheros.iso"
export RANCHEROS_VERSION="v1.3.0"
export RANCHEROS_ISO="https://releases.rancher.com/os/$RANCHEROS_VERSION/rancheros.iso"

@test "$DRIVER: create with RancherOS ISO" {
VIRTUALBOX_BOOT2DOCKER_URL="$RANCHEROS_ISO" run ${BASE_TEST_DIR}/run-bats.sh ${BASE_TEST_DIR}/core
Expand Down