func (ep *endpoint) updateParentHosts() error { ep.Lock() container := ep.container network := ep.network ep.Unlock() if container == nil { return ErrNoContainer{} } for _, update := range container.config.parentUpdates { network.Lock() pep, ok := network.endpoints[types.UUID(update.eid)] if !ok { network.Unlock() continue } network.Unlock() pep.Lock() pContainer := pep.container pep.Unlock() if pContainer != nil { if err := etchosts.Update(pContainer.config.hostsPath, update.ip, update.name); err != nil { return err } } } return nil }
func (sb *sandbox) updateParentHosts() error { var pSb Sandbox for _, update := range sb.config.parentUpdates { sb.controller.WalkSandboxes(SandboxContainerWalker(&pSb, update.cid)) if pSb == nil { continue } if err := etchosts.Update(pSb.(*sandbox).config.hostsPath, update.ip, update.name); err != nil { return err } } return nil }