예제 #1
0
파일: command.go 프로젝트: jmptrader/beacon
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 := &register.Instance{
		Name:    container.ID,
		Service: c.Service,
		Backend: c.Backend,
		Cluster: c.Cluster,
		Proto:   c.Proto,
		Prefix:  prefix,
	}
	return register.RemoveInstance(etcdClient, instance)
}
예제 #2
0
파일: remove.go 프로젝트: jmptrader/beacon
func doRemove(c *cli.Context, client *etcd.Client) {
	instance := &reg.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.")
}