From 839aa777af79e4690923cabd260abf583d4cb56c Mon Sep 17 00:00:00 2001 From: Aleksandr Maus Date: Thu, 29 Apr 2021 21:57:41 -0400 Subject: [PATCH] Agent: Fix panic on receiving osquery action due to bad merge to 7.x (#25447) --- x-pack/elastic-agent/pkg/agent/application/managed_mode.go | 2 +- .../pipeline/actions/handlers/handler_action_application.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/x-pack/elastic-agent/pkg/agent/application/managed_mode.go b/x-pack/elastic-agent/pkg/agent/application/managed_mode.go index 17d1e06599d..117c3d7cca1 100644 --- a/x-pack/elastic-agent/pkg/agent/application/managed_mode.go +++ b/x-pack/elastic-agent/pkg/agent/application/managed_mode.go @@ -231,7 +231,7 @@ func newManaged( actionDispatcher.MustRegister( &fleetapi.ActionApp{}, - handlers.NewAppAction(log), + handlers.NewAppAction(log, managedApplication.srv), ) actionDispatcher.MustRegister( 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 e87d32ad267..a8e7b883258 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 @@ -24,9 +24,10 @@ type AppAction struct { } // NewAppAction creates a new AppAction handler. -func NewAppAction(log *logger.Logger) *AppAction { +func NewAppAction(log *logger.Logger, srv *server.Server) *AppAction { return &AppAction{ log: log, + srv: srv, } }