Show help output on when enroll is missing required args. Fix configTypes=all processing on list services. Fixes GH-155

This commit is contained in:
Paul Lorenz
2020-09-15 09:16:01 -04:00
parent f50d872d17
commit 92edd30fdc
3 changed files with 15 additions and 7 deletions
+2
View File
@@ -5,6 +5,8 @@
* Allow specifying edge config file when using ziti-fabric-test loop2
* Add grouping data to streaming metrics, so values can be associated with their source metric
* New WSS underlay to support Edge Router connections from Browser-based webapps using the ziti-sdk-js
* [ziti#151 enroll subcommand w/out args should print help](https://github.com/openziti/ziti/issues/192)
* Fix processing of `--configTypes all` in `ziti edge list services`
# Release 0.16.2
+4 -2
View File
@@ -45,7 +45,7 @@ const outFlag = "out"
func NewEnrollCommand() *cobra.Command {
var enrollSubCmd = &cobra.Command{
SilenceErrors: true,
SilenceUsage: true,
SilenceUsage: false,
Use: "enroll",
Short: "enroll an identity",
PersistentPreRun: func(cmd *cobra.Command, args []string) {
@@ -83,7 +83,9 @@ func NewEnrollCommand() *cobra.Command {
enrollSubCmd.Flags().StringVarP(&keyPath, "key", "k", "", keyDesc)
_ = enrollSubCmd.MarkFlagRequired("jwt")
if err := enrollSubCmd.MarkFlagRequired("jwt"); err != nil {
panic(err)
}
return enrollSubCmd
}
+9 -5
View File
@@ -480,11 +480,15 @@ func runListServices(asIdentity string, configTypes []string, roleFilters []stri
params.Add("asIdentity", asIdentity)
}
if configTypes, err := mapNamesToIDs("config-types", configTypes...); err != nil {
return err
if len(configTypes) == 1 && strings.EqualFold("all", configTypes[0]) {
params.Add("configTypes", "all")
} else {
for _, configType := range configTypes {
params.Add("configTypes", configType)
if configTypes, err := mapNamesToIDs("config-types", configTypes...); err != nil {
return err
} else {
for _, configType := range configTypes {
params.Add("configTypes", configType)
}
}
}
for _, roleFilter := range roleFilters {
@@ -512,7 +516,7 @@ func outputServices(o *commonOptions, children []*gabs.Container, pagingInfo *pa
terminatorStrategy, _ := entity.Path("terminatorStrategy").Data().(string)
roleAttributes := entity.Path("roleAttributes").String()
_, err := fmt.Fprintf(o.Out, "id: %v name: %v encryption required: %v terminator strategy: %v role attributes: %v\n", id, name, encryptionRequired , terminatorStrategy, roleAttributes)
_, err := fmt.Fprintf(o.Out, "id: %v name: %v encryption required: %v terminator strategy: %v role attributes: %v\n", id, name, encryptionRequired, terminatorStrategy, roleAttributes)
if err != nil {
return err
}