1
0
mirror of https://github.com/rancher/os.git synced 2025-08-31 14:23:11 +00:00

Set rancher.environment.KERNEL_VERSION from /proc/version

Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
This commit is contained in:
Sven Dowideit
2016-11-29 23:09:07 +10:00
parent 4cd20d2163
commit 0ac5a2d40b
3 changed files with 11 additions and 2 deletions

View File

@@ -2,10 +2,13 @@ package docker
import (
"fmt"
"io/ioutil"
"strings"
composeConfig "github.com/docker/libcompose/config"
"github.com/rancher/os/config"
log "github.com/Sirupsen/logrus"
)
type ConfigEnvironment struct {
@@ -41,6 +44,12 @@ func environmentFromCloudConfig(cfg *config.CloudConfig) map[string]string {
environment["no_proxy"] = cfg.Rancher.Network.NoProxy
environment["NO_PROXY"] = cfg.Rancher.Network.NoProxy
}
b, err := ioutil.ReadFile("/proc/version")
if err == nil {
elem := strings.Split(string(b), " ")
environment["KERNEL_VERSION"] = elem[2]
log.Debugf("Using /proc/version to set rancher.environment.KERNEL_VERSION = %s", elem[2])
}
return environment
}