From dc1215968b84e01ec7429091f998bc95c7a3f736 Mon Sep 17 00:00:00 2001 From: Dustin Long Date: Tue, 21 Nov 2023 12:17:30 -0500 Subject: [PATCH] Remove fx.Supply(params) from system-probe command, fix tests --- cmd/agent/subcommands/diagnose/command_test.go | 4 ++-- cmd/agent/subcommands/run/command_windows.go | 2 +- cmd/system-probe/subcommands/run/command.go | 4 ---- comp/core/config/config.go | 3 ++- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/cmd/agent/subcommands/diagnose/command_test.go b/cmd/agent/subcommands/diagnose/command_test.go index d72468da1d80f6..e65974556221f4 100644 --- a/cmd/agent/subcommands/diagnose/command_test.go +++ b/cmd/agent/subcommands/diagnose/command_test.go @@ -75,8 +75,8 @@ func TestShowMetadataInventoryHostCommand(t *testing.T) { Commands(&command.GlobalParams{}), []string{"diagnose", "show-metadata", "inventory-host"}, printPayload, - func(cliParams *cliParams, coreParams core.BundleParams) { - require.Equal(t, false, coreParams.ConfigLoadSecrets()) + func(cliParams *cliParams, coreParams core.BundleParams, secretParams secrets.Params) { + require.Equal(t, false, secretParams.Enabled) require.Equal(t, "inventory-host", cliParams.payloadName) }) } diff --git a/cmd/agent/subcommands/run/command_windows.go b/cmd/agent/subcommands/run/command_windows.go index 0608618c65a090..7e88d057bda77a 100644 --- a/cmd/agent/subcommands/run/command_windows.go +++ b/cmd/agent/subcommands/run/command_windows.go @@ -114,8 +114,8 @@ func StartAgentWithDefaults(ctxChan <-chan context.Context) (<-chan error, error hostMetadata, invAgent, invHost, + secretResolver, ) - secretResolver) if err != nil { return err } diff --git a/cmd/system-probe/subcommands/run/command.go b/cmd/system-probe/subcommands/run/command.go index 65411135354d2e..f288aa756c310b 100644 --- a/cmd/system-probe/subcommands/run/command.go +++ b/cmd/system-probe/subcommands/run/command.go @@ -29,8 +29,6 @@ import ( "github.com/DataDog/datadog-agent/cmd/system-probe/utils" "github.com/DataDog/datadog-agent/comp/core/config" "github.com/DataDog/datadog-agent/comp/core/log" - "github.com/DataDog/datadog-agent/comp/core/secrets" - "github.com/DataDog/datadog-agent/comp/core/secrets/secretsimpl" "github.com/DataDog/datadog-agent/comp/core/sysprobeconfig" "github.com/DataDog/datadog-agent/comp/core/sysprobeconfig/sysprobeconfigimpl" "github.com/DataDog/datadog-agent/comp/core/telemetry" @@ -74,13 +72,11 @@ func Commands(globalParams *command.GlobalParams) []*cobra.Command { fx.Supply(cliParams), fx.Supply(config.NewAgentParams("", config.WithConfigMissingOK(true))), fx.Supply(sysprobeconfigimpl.NewParams(sysprobeconfigimpl.WithSysProbeConfFilePath(globalParams.ConfFilePath))), - fx.Supply(secrets.NewDisabledParams()), fx.Supply(log.ForDaemon("SYS-PROBE", "log_file", common.DefaultLogFile)), config.Module, telemetry.Module, sysprobeconfigimpl.Module, rcclient.Module, - secretsimpl.Module, // use system-probe config instead of agent config for logging fx.Provide(func(lc fx.Lifecycle, params log.Params, sysprobeconfig sysprobeconfig.Component) (log.Component, error) { return log.NewLogger(lc, params, sysprobeconfig) diff --git a/comp/core/config/config.go b/comp/core/config/config.go index cc2f98eb78c157..a74673cc886140 100644 --- a/comp/core/config/config.go +++ b/comp/core/config/config.go @@ -39,7 +39,8 @@ type dependencies struct { fx.In Params Params - Secret secrets.Component + // secrets Component is optional, if not provided, the config will not decrypt secrets + Secret secrets.Component `optional:"true"` } func (d dependencies) getParams() *Params {