示例#1
0
文件: marathon.go 项目: kuende/kameni
func handleMarathonEvent(req *http.Request) {
	event, err := decodeMarathonEvent(req)

	if err != nil {
		log.Errorf("Error decoding data callback: %v", err)
		return
	}

	if err = handleEvent(event); err != nil {
		log.Errorf("%v", err)
	}
}
示例#2
0
文件: vulcand.go 项目: kuende/kameni
func removeVulcandServer(appID string, server VulcandServer) error {
	backend, err := fetchBackend(appID)

	if err != nil {
		log.Errorf("Error fetching backend from etcd: %v", err)
		return err
	}

	path := serverPath(backend, server.ID)

	err = etcdDelete(path)

	if err != nil {
		log.Errorf("Error delete key from etcd: %v", err)
		return err
	}

	log.Infof("Removed server: %s from backend: %s, url: %s", server.ID, backend.BackendID, server.URL)
	return nil
}
示例#3
0
文件: vulcand.go 项目: kuende/kameni
func fetchBackend(appID string) (*BackendConfig, error) {
	value, err := etcdGet(appPath(appID))

	if err != nil {
		log.Errorf("Error fetching backend from etcd: %v", err)
		return nil, err
	}

	backend := BackendConfig{}
	err = json.Unmarshal(value, &backend)

	return &backend, err
}
示例#4
0
文件: vulcand.go 项目: kuende/kameni
func addVulcandServer(appID string, server VulcandServer) error {
	backend, err := fetchBackend(appID)

	if err != nil {
		return err
	}

	path := serverPath(backend, server.ID)
	value := backend.Format(server)

	err = etcdSet(path, value)

	if err != nil {
		log.Errorf("Error setting key in etcd: %v", err)
		return err
	}

	log.Infof("Added server: %s to backend: %s, url: %s", server.ID, backend.BackendID, server.URL)
	return nil
}
示例#5
0
文件: main.go 项目: kuende/kameni
func die(err error) {
	log.Errorf("%v", err)
	os.Exit(1)
}