Example #1
0
func (slbDaemon *SLBDaemon) SendCommand(command *slb.Command) error {
	command.NodeHostSlice = slbDaemon.NodeHostSlice

	buffer := bytes.Buffer{}
	for _, endPoint := range slbDaemon.EndPointSlice {
		url := endPoint + "/api/v1/slb"
		_, err := restclient.RequestPut(url, command, nil, false)
		if err != nil {
			log.Error(err)
			buffer.WriteString("Fail to configure " + endPoint + " with error " + err.Error() + "\n")
		}
	}

	if buffer.Len() > 0 {
		return errors.New(buffer.String())
	} else {
		return nil
	}
}