1
0
mirror of https://github.com/rancher/os.git synced 2025-09-01 14:48:55 +00:00

Add sysctl support in cloud config

This commit is contained in:
Josh Curl
2016-06-17 23:05:45 -07:00
parent eb0c262ef7
commit 921c00c8ea
5 changed files with 39 additions and 0 deletions

View File

@@ -19,8 +19,10 @@ import (
"errors"
"flag"
"fmt"
"io/ioutil"
"os"
"os/exec"
"path"
"strings"
"sync"
"time"
@@ -227,6 +229,15 @@ func executeCloudConfig() error {
}
}
for k, v := range cc.Rancher.Sysctl {
elems := []string{"/proc", "sys"}
elems = append(elems, strings.Split(k, ".")...)
path := path.Join(elems...)
if err := ioutil.WriteFile(path, []byte(v), 0644); err != nil {
log.Errorf("Failed to set sysctl key %s: %s", k, err)
}
}
return nil
}