Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tetragon: fail if --username-metadata receives invalid value #2596

Merged
merged 1 commit into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/tetragon/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ func execute() error {
}

if err := option.ReadAndSetFlags(); err != nil {
log.WithError(err).Fatal("Failed to start gops")
log.WithError(err).Fatal("Failed to parse command line flags")
}
if err := startGopsServer(); err != nil {
log.WithError(err).Fatal("Failed to start gops")
Expand Down
6 changes: 4 additions & 2 deletions pkg/option/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,13 @@ func ReadAndSetFlags() error {

Config.TracingPolicy = viper.GetString(KeyTracingPolicy)

switch viper.GetString(KeyUsernameMetadata) {
switch o := viper.GetString(KeyUsernameMetadata); o {
case "unix":
Config.UsernameMetadata = int(USERNAME_METADATA_UNIX)
default:
case "disabled":
Config.UsernameMetadata = int(USERNAME_METADATA_DISABLED)
default:
return fmt.Errorf("unknown option for %s: %q", KeyUsernameMetadata, o)
}

// manually handle the deprecation of --expose-kernel-addresses
Expand Down
Loading