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:
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user