コード例 #1
0
ファイル: rpc.go プロジェクト: irregular/atlantis-manager
func selfRegister() {
	log.Println("[SelfRegister] Registering Self.")
	zkManager, err := datamodel.GetManager(Region, Host)
	if err == nil && zkManager != nil {
		// i'm already registered
		log.Println("[SelfRegister] Already Registered")
		return
	}
	mgr, err := manager.Register(Region, Host, "", "")
	if err != nil {
		log.Fatalln("[SelfRegister] Failure: ", err)
	}
	log.Printf("[SelfRegister] Success: %s", mgr.ManagerCName)
}
コード例 #2
0
func (e *RegisterManagerExecutor) Execute(t *Task) error {
	if e.arg.Host == "" {
		return errors.New("Please specify an Host to register")
	}
	if e.arg.Region == "" {
		return errors.New("Please specify a Region to register")
	}
	mgr, err := manager.Register(e.arg.Region, e.arg.Host, e.arg.RegistryCName, e.arg.ManagerCName)
	castedManager := Manager(*mgr)
	e.reply.Manager = &castedManager
	if err != nil {
		e.reply.Status = StatusError
	} else {
		e.reply.Status = StatusOk
	}
	return err
}