fix: Linux-Agent Update — platform im Heartbeat mitschicken, Backend nutzt plattformspezifische Firmware statt hardcoded freebsd
This commit is contained in:
parent
7ebbdc76cb
commit
e565039743
@ -184,6 +184,7 @@ func sendHeartbeat(c *client.Client, agentID string) error {
|
||||
req := map[string]interface{}{
|
||||
"agent_id": agentID,
|
||||
"agent_version": Version,
|
||||
"platform": "linux",
|
||||
"system_data": systemData,
|
||||
}
|
||||
|
||||
|
||||
@ -263,9 +263,13 @@ func (h *Handler) heartbeat(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
resp := models.HeartbeatResponse{Message: "OK"}
|
||||
|
||||
// Pruefen ob Update ansteht (default freebsd fuer OPNsense)
|
||||
// Pruefen ob Update ansteht — Plattform aus Heartbeat-Request verwenden
|
||||
if h.db.IsUpdateRequested(req.AgentID) {
|
||||
version, hash, _, err := h.db.GetFirmwareInfo("freebsd")
|
||||
platform := req.Platform
|
||||
if platform == "" {
|
||||
platform = "freebsd" // Default fuer OPNsense Agents ohne Platform-Feld
|
||||
}
|
||||
version, hash, _, err := h.db.GetFirmwareInfo(platform)
|
||||
if err != nil {
|
||||
// Keine Firmware vorhanden — Flag sinnlos, loeschen
|
||||
h.db.ClearUpdateRequest(req.AgentID)
|
||||
|
||||
@ -282,6 +282,7 @@ type CaddyData struct {
|
||||
type HeartbeatRequest struct {
|
||||
AgentID string `json:"agent_id"`
|
||||
AgentVersion string `json:"agent_version,omitempty"`
|
||||
Platform string `json:"platform,omitempty"`
|
||||
SystemData SystemData `json:"system_data"`
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user