fix: resolve frontend approval error and add invalid command handling

- Added missing approveMultiple function to updateApi
- Fixed API endpoint from /updates/bulk-approve to /updates/approve
- Enhanced invalid command handling in both Linux and Windows agents
- Agents now report unknown command types as failed commands back to server
This commit is contained in:
Fimeg
2025-11-01 21:56:31 -04:00
parent 3690472396
commit 99480f3fe3
2 changed files with 33 additions and 6 deletions

View File

@@ -695,7 +695,20 @@ func runAgent(cfg *config.Config) error {
log.Printf("[Reboot] Error processing reboot command: %v\n", err)
}
default:
log.Printf("Unknown command type: %s\n", cmd.Type)
log.Printf("Unknown command type: %s - reporting as invalid command\n", cmd.Type)
// Report invalid command back to server
logReport := client.LogReport{
CommandID: cmd.ID,
Action: "process_command",
Result: "failed",
Stdout: "",
Stderr: fmt.Sprintf("Invalid command type: %s", cmd.Type),
ExitCode: 1,
DurationSeconds: 0,
}
if reportErr := reportLogWithAck(apiClient, cfg, ackTracker, logReport); reportErr != nil {
log.Printf("Failed to report invalid command result: %v", reportErr)
}
}
}