Пример #1
0
//UpdateService updates only the given service from actual configuration
func UpdateService(old model.Service) error {
	//Do not start a new check while updating by claiming it.
	old.Claim()
	for _, new := range loader.FindServices() {
		if new.Identifier == old.Identifier {
			new.CopyAttributes(&old)
			//push new service to Services map
			model.Services.Set(old.Identifier, new)

			log.Warning("Reloaded", new.Identifier, "from", old.Identifier)
			return nil
		}
	}

	return errors.New("Service not found.")
}