1
0
mirror of https://github.com/rancher/os.git synced 2025-06-21 04:31:55 +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
}

View File

@ -1,6 +1,6 @@
#cloud-config
rancher:
services_include:
kernel-headers-4.8.10-rancher: true
kernel-headers: true
ssh_authorized_keys:
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC85w9stZyiLQp/DkVO6fqwiShYcj1ClKdtCqgHtf+PLpJkFReSFu8y21y+ev09gsSMRRrjF7yt0pUHV6zncQhVeqsZtgc5WbELY2DOYUGmRn/CCvPbXovoBrQjSorqlBmpuPwsStYLr92Xn+VVsMNSUIegHY22DphGbDKG85vrKB8HxUxGIDxFBds/uE8FhSy+xsoyT/jUZDK6pgq2HnGl6D81ViIlKecpOpWlW3B+fea99ADNyZNVvDzbHE5pcI3VRw8u59WmpWOUgT6qacNVACl8GqpBvQk8sw7O/X9DSZHCKafeD9G5k+GYbAUz92fKWrx/lOXfUXPS3+c8dRIF

View File

@ -7,5 +7,5 @@ func (s *QemuSuite) TestKernelHeaders(c *C) {
s.CheckCall(c, `
sleep 15
docker inspect kernel-headers-$(uname -r)`)
docker inspect kernel-headers`)
}