func (c *Command) unregisterInstance(etcdClient *etcd.Client, container *docker.APIContainers, prefix string) error { log.WithFields(log.Fields{ "id": container.ID, }).Debugln("start to unregister instance.") instance := ®ister.Instance{ Name: container.ID, Service: c.Service, Backend: c.Backend, Cluster: c.Cluster, Proto: c.Proto, Prefix: prefix, } return register.RemoveInstance(etcdClient, instance) }
func doRemove(c *cli.Context, client *etcd.Client) { instance := ®.Instance{ Name: c.String("name"), Service: c.String("service"), Backend: c.String("backend"), Proto: c.String("proto"), Cluster: c.String("cluster"), Ip: c.String("host"), Listen: c.String("port"), Prefix: c.GlobalString("prefix"), } if err := reg.RemoveInstance(client, instance); err != nil { log.Fatalln(err.Error()) } log.WithFields(log.Fields{ "name": instance.Name, "service": instance.Service, "backend": instance.Backend, }).Infoln("unregister an instance.") }