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:
@@ -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
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user