mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #160 from mavenugo/ipv6test
Ignore the OldHash if the resolvConfPath is invalid
This commit is contained in:
commit
1c21e59b97
2 changed files with 12 additions and 8 deletions
|
@ -526,21 +526,23 @@ func (ep *endpoint) updateDNS(resolvConf []byte) error {
|
|||
return ErrNoContainer
|
||||
}
|
||||
|
||||
oldHash := []byte{}
|
||||
hashFile := container.config.resolvConfPath + ".hash"
|
||||
oldHash, err := ioutil.ReadFile(hashFile)
|
||||
if err != nil {
|
||||
if !os.IsNotExist(err) {
|
||||
return err
|
||||
}
|
||||
|
||||
oldHash = []byte{}
|
||||
}
|
||||
|
||||
resolvBytes, err := ioutil.ReadFile(container.config.resolvConfPath)
|
||||
if err != nil {
|
||||
if !os.IsNotExist(err) {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
oldHash, err = ioutil.ReadFile(hashFile)
|
||||
if err != nil {
|
||||
if !os.IsNotExist(err) {
|
||||
return err
|
||||
}
|
||||
|
||||
oldHash = []byte{}
|
||||
}
|
||||
}
|
||||
|
||||
curHash, err := ioutils.HashData(bytes.NewReader(resolvBytes))
|
||||
|
|
|
@ -995,6 +995,7 @@ func TestEnableIPv6(t *testing.T) {
|
|||
}
|
||||
|
||||
resolvConfPath := "/tmp/libnetwork_test/resolv.conf"
|
||||
defer os.Remove(resolvConfPath)
|
||||
|
||||
_, err = ep1.Join(containerID,
|
||||
libnetwork.JoinOptionResolvConfPath(resolvConfPath))
|
||||
|
@ -1061,6 +1062,7 @@ func TestResolvConf(t *testing.T) {
|
|||
}
|
||||
|
||||
resolvConfPath := "/tmp/libnetwork_test/resolv.conf"
|
||||
defer os.Remove(resolvConfPath)
|
||||
|
||||
_, err = ep1.Join(containerID,
|
||||
libnetwork.JoinOptionResolvConfPath(resolvConfPath))
|
||||
|
|
Loading…
Reference in a new issue