Skip to content

Commit

Permalink
Update px api-key create and px get cluster to write to stdout
Browse files Browse the repository at this point in the history
Summary: These commands in particular are used to pipe the output as variables to downstream tools, so we should write to stdout.

Test Plan: Run commands with bazel.

Reviewers: vihang

Reviewed By: vihang

Signed-off-by: Michelle Nguyen <michellenguyen@pixielabs.ai>

Differential Revision: https://phab.corp.pixielabs.ai/D11521

GitOrigin-RevId: f362601
  • Loading branch information
aimichelle authored and copybaranaut committed Jun 7, 2022
1 parent 62afd6b commit cb05fe2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/pixie_cli/pkg/cmd/api_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ var CreateAPIKeyCmd = &cobra.Command{
log.WithError(err).Fatal("Failed to generate API key")
}
if short {
utils.Infof(key)
fmt.Fprintf(os.Stdout, "%s\n", key)
} else {
utils.Infof("Generated API key: \nID: %s \nKey: %s", keyID, key)
}
Expand Down
4 changes: 2 additions & 2 deletions src/pixie_cli/pkg/cmd/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,12 @@ var GetClusterCmd = &cobra.Command{
cloudAddr := vizier.GetCloudAddrFromKubeConfig(config)

if id {
cliUtils.Infof("%s", clusterID)
fmt.Fprintf(os.Stdout, "%s\n", clusterID)
return
}

if addr {
cliUtils.Infof("%s", cloudAddr)
fmt.Fprintf(os.Stdout, "%s\n", cloudAddr)
return
}

Expand Down

0 comments on commit cb05fe2

Please sign in to comment.