[WIP] Error and state handleing improvments, better logs

This commit is contained in:
Vladimir Stoilov
2024-09-19 12:38:23 +03:00
parent 072d7e6971
commit b3ff6f14f1
24 changed files with 146 additions and 1981 deletions

View File

@@ -107,27 +107,29 @@ func registerAPIEndpoints() error {
}
if err := api.RegisterEndpoint(api.Endpoint{
Path: "updates/check",
Read: api.PermitUser,
Path: "updates/check",
WriteMethod: "POST",
Write: api.PermitUser,
ActionFunc: func(ar *api.Request) (string, error) {
module.instance.BinaryUpdates().TriggerUpdateCheck()
module.instance.IntelUpdates().TriggerUpdateCheck()
return "update check triggered", nil
},
Name: "Get the ID of the calling profile",
Name: "Trigger updates check event",
}); err != nil {
return err
}
if err := api.RegisterEndpoint(api.Endpoint{
Path: "updates/apply",
Read: api.PermitUser,
Path: "updates/apply",
WriteMethod: "POST",
Write: api.PermitUser,
ActionFunc: func(ar *api.Request) (string, error) {
module.instance.BinaryUpdates().TriggerApplyUpdates()
module.instance.IntelUpdates().TriggerApplyUpdates()
return "upgrade triggered", nil
},
Name: "Get the ID of the calling profile",
Name: "Trigger updates apply event",
}); err != nil {
return err
}