From 3a3270f2c6ec00ebc2267e8f77afaac4bbbd5d82 Mon Sep 17 00:00:00 2001 From: Darren Shepherd Date: Fri, 18 Sep 2015 22:27:53 -0700 Subject: [PATCH] Fix systemd emulation --- Godeps/Godeps.json | 4 ++-- .../rancher/docker-from-scratch/scratch.go | 18 ++++++++++-------- .../docker-from-scratch/scripts/download | 2 +- .../docker-from-scratch/scripts/version | 2 +- init/init.go | 1 + 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 464dd144..09aa80c3 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -351,8 +351,8 @@ }, { "ImportPath": "github.com/rancher/docker-from-scratch", - "Comment": "1.8.1-2-gbcc17ea", - "Rev": "bcc17eae6f79e46cb65a74e4406cb3bcc24c38fb" + "Comment": "v1.8.2-1", + "Rev": "500f0babfdbfcd55fbdbf6690e4508ceb7323474" }, { "ImportPath": "github.com/rancher/netconf", diff --git a/Godeps/_workspace/src/github.com/rancher/docker-from-scratch/scratch.go b/Godeps/_workspace/src/github.com/rancher/docker-from-scratch/scratch.go index 358d1543..b7c8070a 100644 --- a/Godeps/_workspace/src/github.com/rancher/docker-from-scratch/scratch.go +++ b/Godeps/_workspace/src/github.com/rancher/docker-from-scratch/scratch.go @@ -138,7 +138,7 @@ func CreateSymlinks(pathSets [][]string) error { func CreateSymlink(src, dest string) error { if _, err := os.Lstat(dest); os.IsNotExist(err) { - log.Debugf("Symlinking %s => %s", src, dest) + log.Debugf("Symlinking %s => %s", dest, src) if err = os.Symlink(src, dest); err != nil { return err } @@ -458,14 +458,16 @@ func prepare(config *Config, docker string, args ...string) error { func setupSystemd(config *Config) error { if !config.EmulateSystemd { - cgroups, err := ioutil.ReadFile(fmt.Sprintf("/proc/%d/cgroup", os.Getpid())) - if err != nil { - return err - } + return nil + } - if !strings.Contains(string(cgroups), "name=systemd") { - return nil - } + cgroups, err := ioutil.ReadFile(fmt.Sprintf("/proc/%d/cgroup", os.Getpid())) + if err != nil { + return err + } + + if strings.Contains(string(cgroups), "name=systemd") { + return nil } if err := createMounts(systemdMounts...); err != nil { diff --git a/Godeps/_workspace/src/github.com/rancher/docker-from-scratch/scripts/download b/Godeps/_workspace/src/github.com/rancher/docker-from-scratch/scripts/download index c073f227..a686e2b9 100644 --- a/Godeps/_workspace/src/github.com/rancher/docker-from-scratch/scripts/download +++ b/Godeps/_workspace/src/github.com/rancher/docker-from-scratch/scripts/download @@ -47,7 +47,7 @@ else cp assets/base-files.tar.gz build fi -download 9a711e6b98a388b12091cf716c5996b67a2e223a https://get.docker.com/builds/Linux/x86_64/docker-1.8.1 +download ad3618b980105d907aae7bba40ca3ababb7c3d6d https://get.docker.com/builds/Linux/x86_64/docker-1.8.2 cp assets/docker-* build/docker chmod +x build/docker diff --git a/Godeps/_workspace/src/github.com/rancher/docker-from-scratch/scripts/version b/Godeps/_workspace/src/github.com/rancher/docker-from-scratch/scripts/version index a8fdfda1..53adb84c 100644 --- a/Godeps/_workspace/src/github.com/rancher/docker-from-scratch/scripts/version +++ b/Godeps/_workspace/src/github.com/rancher/docker-from-scratch/scripts/version @@ -1 +1 @@ -1.8.1 +1.8.2 diff --git a/init/init.go b/init/init.go index 528670c6..60de29d9 100644 --- a/init/init.go +++ b/init/init.go @@ -140,6 +140,7 @@ func getLaunchConfig(cfg *config.CloudConfig, dockerCfg *config.DockerConfig) (* launchConfig.DnsConfig.Nameservers = cfg.Rancher.Network.Dns.Nameservers launchConfig.DnsConfig.Search = cfg.Rancher.Network.Dns.Search launchConfig.Environment = dockerCfg.Environment + launchConfig.EmulateSystemd = true if !cfg.Rancher.Debug { launchConfig.LogFile = config.SYSTEM_DOCKER_LOG