Esempio n. 1
0
func handleApiEvents(logContext *logrus.Entry, client string, events []*omaha.Event) error {
	for _, event := range events {
		evType, err := strconv.Atoi(event.Type)
		if err != nil {
			return err
		}

		evResult, err := strconv.Atoi(event.Result)
		if err != nil {
			return err
		}

		err = db.LogEvent(client, evType, evResult)
		if err != nil {
			logContext.Error(err)
		}
		switch evType {
		case eventTypeDownload:
			logContext.Info("Client is downloading new version.")
		case eventTypeArrive:
			logContext.Info("Client finished download.")
		case eventTypeApply:
			switch evResult {
			case eventResultOK:
				logContext.Info("Client applied package.")
			case eventResultError:
				logContext.Info("Client errored during update.")
			case eventResultDone:
				logContext.Info("Client upgraded to current version.")
			}
		case eventTypeSuccess:
			logContext.Info("Install success. Update completion prevented by instance.")
		default:
			logContext.Warn("Unknown event type %v.", evType)
		}
	}
	return nil
}
Esempio n. 2
0
func GetUpdates(c *gin.Context, d *GetUpdatesCommand, q *NuGetQuery, logger *log.Entry) {
	logger.Warn("GetUpdates not implemented")
	c.Status(501)
}