From 472e3a7c037fbcf30ef4c39ae438ba9d9be1ea1e Mon Sep 17 00:00:00 2001 From: Aleksandr Maus Date: Thu, 10 Jun 2021 11:56:44 -0400 Subject: [PATCH] Populate the agent action result if there is no matching action handlers (#26152) --- .../pipeline/actions/handlers/handler_action_application.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/x-pack/elastic-agent/pkg/agent/application/pipeline/actions/handlers/handler_action_application.go b/x-pack/elastic-agent/pkg/agent/application/pipeline/actions/handlers/handler_action_application.go index a8e7b883258..5a49fdeb184 100644 --- a/x-pack/elastic-agent/pkg/agent/application/pipeline/actions/handlers/handler_action_application.go +++ b/x-pack/elastic-agent/pkg/agent/application/pipeline/actions/handlers/handler_action_application.go @@ -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()