Skip to content
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
4 changes: 1 addition & 3 deletions docs/commands/rhoas_serviceaccount_create.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@ rhoas serviceaccount create [flags]
=== Examples

....
$ rhoas serviceaccount create
$ rhoas serviceaccount create --output kafka
$ rhoas serviceaccount create --output=env
$ rhoas serviceaccount create -o=properties
$ rhoas serviceaccount create -o env --force
$ rhoas serviceaccount create -o json
....

=== Options
Expand Down
5 changes: 4 additions & 1 deletion pkg/cmd/serviceaccount/create/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,16 @@ func NewCreateCommand(f *factory.Factory) *cobra.Command {
if opts.output == "" {
return fmt.Errorf("--output is a required flag")
}
}

if opts.output != "" {
// check that a valid --output flag value is used
validOutput := flagutil.IsValidInput(opts.output, flagutil.CredentialsOutputFormats...)
if !validOutput {
return fmt.Errorf("Invalid value for --output. Valid values: %q", flagutil.CredentialsOutputFormats)
}
}

}
return runCreate(opts)
},
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmdutil/flags/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

var (
AllowedListFormats = []string{"plain", "json", "yml", "yaml"}
CredentialsOutputFormats = []string{"env", "json", "properties", "kafka", "kube"}
CredentialsOutputFormats = []string{"env", "json", "properties", "kube"}
)

// MustGetDefinedString attempts to get a non-empty string flag from the provided flag set or panic
Expand Down
4 changes: 2 additions & 2 deletions pkg/serviceaccount/credentials/credentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ func AbsolutePath(outputFormat string, customLocation string) (filePath string)
switch outputFormat {
case "env":
filePath = ".env"
case "properties", "kafka":
filePath = "kafka.properties"
case "properties":
filePath = "credentials.properties"
case "json":
filePath = "credentials.json"
case "kube":
Expand Down