Example #1
0
func NewIpam(client *docker.Client, version string) (ipamapi.Ipam, error) {
	resolver := func() (string, error) {
		addr, err := client.GetContainerIP(WeaveContainer)
		if _, ok := err.(*godocker.NoSuchContainer); ok {
			return "", fmt.Errorf("%s container is not present. Have you launched it?", WeaveContainer)
		}
		return addr, err
	}
	return &ipam{client: client, weave: api.NewClientWithResolver(resolver)}, nil
}
Example #2
0
func NewWatcher(client *docker.Client, driver *driver) (Watcher, error) {
	resolver := func() (string, error) { return client.GetContainerIP(WeaveContainer) }
	w := &watcher{client: client, driver: driver,
		weave: weaveapi.NewClientWithResolver(resolver)}
	err := client.AddObserver(w)
	if err != nil {
		return nil, err
	}

	return w, nil
}
Example #3
0
func NewIpam(client *docker.Client, version string) (ipamapi.Ipam, error) {
	resolver := func() (string, error) { return client.GetContainerIP(WeaveContainer) }
	return &ipam{client: client, weave: api.NewClientWithResolver(resolver)}, nil
}