We should add a --debug flag to teleport, and for commands that don't start a daemon it should ignore the log level in config file.
Expected behavior:
If I run a command like teleport discovery bootstrap -c /etc/teleport.yaml and I get an error message, I expect to see a normal error message format instead of debug level format.
Example expected output:
$ teleport discovery bootstrap -c ~/code/dev/clusters/alpha/agent.yaml --manual
Reading configuration at "/Users/gavin/code/dev/clusters/alpha/agent.yaml"...
ERROR: discovery service type does not support "ec2x", supported resource types are: [ec2 eks rds rdsproxy redshift redshift-serverless elasticache memorydb opensearch docdb]
Current behavior:
If a teleport yaml config file has log level set to DEBUG, then the command that acts on the config file will also use DEBUG level, and error messages are formatted for debug mode:
$ teleport discovery bootstrap -c ~/code/dev/clusters/alpha/agent.yaml --manual
Reading configuration at "/Users/gavin/code/dev/clusters/alpha/agent.yaml"...
ERROR REPORT:
Original Error: *trace.BadParameterError discovery service type does not support "ec2x", supported resource types are: [ec2 eks rds rdsproxy redshift redshift-serverless elasticache memorydb opensearch docdb]
Stack Trace:
github.com/gravitational/teleport/api/types/matchers_aws.go:116 github.com/gravitational/teleport/api/types.(*AWSMatcher).CheckAndSetDefaults
github.com/gravitational/teleport/lib/config/configuration.go:1597 github.com/gravitational/teleport/lib/config.applyDiscoveryConfig
github.com/gravitational/teleport/lib/config/configuration.go:664 github.com/gravitational/teleport/lib/config.ApplyFileConfig
github.com/gravitational/teleport/lib/configurators/configuratorbuilder/builder.go:38 github.com/gravitational/teleport/lib/configurators/configuratorbuilder.BuildConfigurators
github.com/gravitational/teleport/tool/teleport/common/configurator.go:144 github.com/gravitational/teleport/tool/teleport/common.onConfigureDiscoveryBootstrap
github.com/gravitational/teleport/tool/teleport/common/teleport.go:685 github.com/gravitational/teleport/tool/teleport/common.Run
github.com/gravitational/teleport/e/tool/teleport/main.go:19 main.main
runtime/proc.go:271 runtime.main
runtime/asm_arm64.s:1222 runtime.goexit
User Message: discovery service type does not support "ec2x", supported resource types are: [ec2 eks rds rdsproxy redshift redshift-serverless elasticache memorydb opensearch docdb]
Bug details:
Teleport version: v16
Recreation steps: use the same command from my example, and misconfigure the discovery_service section in some way to trigger an error. I used an invalid matcher type:
We should add a
--debug
flag toteleport
, and for commands that don't start a daemon it should ignore the log level in config file.Expected behavior:
If I run a command like
teleport discovery bootstrap -c /etc/teleport.yaml
and I get an error message, I expect to see a normal error message format instead of debug level format.Example expected output:
Current behavior:
If a teleport yaml config file has log level set to DEBUG, then the command that acts on the config file will also use DEBUG level, and error messages are formatted for debug mode:
Example unexpected output:
Bug details: