Merge pull request #8111 from Luap99/fix-missing-resolv.conf

Don't error if resolv.conf does not exists
This commit is contained in:
OpenShift Merge Robot
2020-10-22 17:47:03 -04:00
committed by GitHub

View File

@ -1412,7 +1412,8 @@ func (c *Container) generateResolvConf() (string, error) {
// Determine the endpoint for resolv.conf in case it is a symlink
resolvPath, err := filepath.EvalSymlinks(resolvConf)
if err != nil {
// resolv.conf doesn't have to exists
if err != nil && !os.IsNotExist(err) {
return "", err
}
@ -1422,7 +1423,8 @@ func (c *Container) generateResolvConf() (string, error) {
}
contents, err := ioutil.ReadFile(resolvPath)
if err != nil {
// resolv.conf doesn't have to exists
if err != nil && !os.IsNotExist(err) {
return "", errors.Wrapf(err, "unable to read %s", resolvPath)
}