Skip to content

Commit

Permalink
Remove fx.Supply(params) from system-probe command, fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dustmop committed Nov 21, 2023
1 parent c91b2f9 commit dc12159
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
4 changes: 2 additions & 2 deletions cmd/agent/subcommands/diagnose/command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
}
2 changes: 1 addition & 1 deletion cmd/agent/subcommands/run/command_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ func StartAgentWithDefaults(ctxChan <-chan context.Context) (<-chan error, error
hostMetadata,
invAgent,
invHost,
secretResolver,
)
secretResolver)
if err != nil {
return err
}
Expand Down
4 changes: 0 additions & 4 deletions cmd/system-probe/subcommands/run/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion comp/core/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit dc12159

Please sign in to comment.