From ee9c21c5f1b9b09bf738c85bbee05c0f8646c5d3 Mon Sep 17 00:00:00 2001 From: Ivan Mikushin Date: Mon, 28 Mar 2016 13:50:29 -0700 Subject: [PATCH] Use docker images for the current architecture (vs just for amd64) Fix #828, #835 --- cmd/control/install.go | 2 +- cmd/control/selinux.go | 2 +- config/types.go | 9 +++++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/cmd/control/install.go b/cmd/control/install.go index 775ecbef..e675bdc5 100644 --- a/cmd/control/install.go +++ b/cmd/control/install.go @@ -63,7 +63,7 @@ func installAction(c *cli.Context) { log.WithFields(log.Fields{"err": err}).Fatal("ros install: failed to load config") } if image == "" { - image = cfg.Rancher.Upgrade.Image + ":" + config.VERSION + image = cfg.Rancher.Upgrade.Image + ":" + config.VERSION + config.SUFFIX } installType := c.String("install-type") diff --git a/cmd/control/selinux.go b/cmd/control/selinux.go index 1b72472e..e6afc8c6 100644 --- a/cmd/control/selinux.go +++ b/cmd/control/selinux.go @@ -49,7 +49,7 @@ func selinuxCommand() cli.Command { "-v", "/etc/selinux:/etc/selinux", "-v", "/var/lib/selinux:/var/lib/selinux", "-v", "/usr/share/selinux:/usr/share/selinux", - fmt.Sprintf("rancher/os-selinuxtools:%s", config.VERSION), "bash"} + fmt.Sprintf("rancher/os-selinuxtools:%s", config.VERSION + config.SUFFIX), "bash"} syscall.Exec("/bin/system-docker", argv, []string{}) } diff --git a/config/types.go b/config/types.go index 60827747..ee708af7 100644 --- a/config/types.go +++ b/config/types.go @@ -4,6 +4,7 @@ import ( "github.com/coreos/coreos-cloudinit/config" "github.com/docker/libcompose/project" "github.com/rancher/netconf" + "runtime" ) const ( @@ -44,12 +45,20 @@ const ( var ( OemConfigFile = OEM + "/oem-config.yml" VERSION string + ARCH string + SUFFIX string ) func init() { if VERSION == "" { VERSION = "v0.0.0-dev" } + if ARCH == "" { + ARCH = runtime.GOARCH + } + if SUFFIX == "" && ARCH != "amd64" { + SUFFIX = "_" + ARCH + } } type Repository struct {