Skip to content

Commit

Permalink
Populate the agent action result if there is no matching action handl…
Browse files Browse the repository at this point in the history
…ers (#26152) (#26243)

(cherry picked from commit 472e3a7)

Co-authored-by: Aleksandr Maus <aleksandr.maus@elastic.co>
  • Loading branch information
mergify[bot] and aleksmaus authored Jun 10, 2021
1 parent 2a504ed commit e9a3f18
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ func (h *AppAction) Handle(ctx context.Context, a fleetapi.Action, acker store.F

appState, ok := h.srv.FindByInputType(action.InputType)
if !ok {
return fmt.Errorf("matching app is not found for action input: %s", action.InputType)
// If the matching action is not found ack the action with the error for action result document
action.StartedAt = time.Now().UTC().Format(time.RFC3339Nano)
action.CompletedAt = action.StartedAt
action.Error = fmt.Sprintf("matching app is not found for action input: %s", action.InputType)
return acker.Ack(ctx, action)
}

params, err := action.MarshalMap()
Expand Down

0 comments on commit e9a3f18

Please sign in to comment.