Updated handling of disable_ipv6 file

Signed-off-by: Jim Carroll <jim.carroll@docker.com>
This commit is contained in:
Jim Carroll 2018-04-02 16:19:24 -05:00
parent e0c5c1b5d3
commit 9da8e04c70
1 changed files with 9 additions and 0 deletions

View File

@ -616,6 +616,15 @@ func reexecSetIPv6() {
value = byte('0')
}
if _, err := os.Stat(path); err != nil {
if os.IsNotExist(err) {
logrus.Warnf("file does not exist: %s : %v Has IPv6 been disabled in this node's kernel?", path, err)
os.Exit(0)
}
logrus.Errorf("failed to stat %s : %v", path, err)
os.Exit(5)
}
if err = ioutil.WriteFile(path, []byte{value, '\n'}, 0644); err != nil {
logrus.Errorf("failed to %s IPv6 forwarding for container's interface %s: %v", action, os.Args[2], err)
os.Exit(4)