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