func (p *dockerProvisioner) fixContainer(container *container.Container, info container.NetworkInfo) error { if info.HTTPHostPort == "" { return nil } appInstance, err := app.GetByName(container.AppName) if err != nil { return err } r, err := getRouterForApp(appInstance) if err != nil { return err } err = r.RemoveRoute(container.AppName, container.Address()) if err != nil && err != router.ErrRouteNotFound { return err } container.IP = info.IP container.HostPort = info.HTTPHostPort err = r.AddRoute(container.AppName, container.Address()) if err != nil && err != router.ErrRouteExists { return err } coll := p.Collection() defer coll.Close() return coll.Update(bson.M{"id": container.ID}, container) }
func (p *dockerProvisioner) fixContainer(container *container.Container, info container.NetworkInfo) error { if info.HTTPHostPort == "" { return nil } container.IP = info.IP container.HostPort = info.HTTPHostPort coll := p.Collection() defer coll.Close() err := coll.Update(bson.M{"id": container.ID}, bson.M{ "$set": bson.M{"hostport": container.HostPort, "ip": container.IP}, }) lockedRoutesRebuildOrEnqueue(container.AppName) return err }