diff --git a/x-pack/elastic-agent/CHANGELOG.next.asciidoc b/x-pack/elastic-agent/CHANGELOG.next.asciidoc index c3dc8b38ce2..403f0a106c6 100644 --- a/x-pack/elastic-agent/CHANGELOG.next.asciidoc +++ b/x-pack/elastic-agent/CHANGELOG.next.asciidoc @@ -55,7 +55,8 @@ - Fixed: limit for retries to Kibana configurable {issue}25063[25063] - Fix issue with status and inspect inside of container {pull}25204[25204] - Remove FLEET_SERVER_POLICY_NAME env variable as it was not used {pull}25149[25149] -- Reduce log level for listener cleanup to debug {pull}25274 +- Passing in policy id to container command works {pull}25352[25352] +- Reduce log level for listener cleanup to debug {pull}25274[25274] ==== New features diff --git a/x-pack/elastic-agent/pkg/agent/cmd/container.go b/x-pack/elastic-agent/pkg/agent/cmd/container.go index 35437e68376..a370c4f3106 100644 --- a/x-pack/elastic-agent/pkg/agent/cmd/container.go +++ b/x-pack/elastic-agent/pkg/agent/cmd/container.go @@ -139,8 +139,8 @@ func logError(streams *cli.IOStreams, err error) { fmt.Fprintf(streams.Err, "Error: %v\n", err) } -func logInfo(streams *cli.IOStreams, msg string) { - fmt.Fprintln(streams.Out, msg) +func logInfo(streams *cli.IOStreams, a ...interface{}) { + fmt.Fprintln(streams.Out, a...) } func logContainerCmd(streams *cli.IOStreams, cmd *cobra.Command) error { @@ -292,10 +292,11 @@ func runContainerCmd(streams *cli.IOStreams, cmd *cobra.Command, cfg setupConfig return err } } - policyID := "" + policyID := cfg.FleetServer.PolicyID if policy != nil { policyID = policy.ID } + logInfo(streams, "Policy selected for enrollment: ", policyID) cmdArgs, err := buildEnrollArgs(cfg, token, policyID) if err != nil { return err