30x / shipyardctl

command line interface for Shipyard API
Apache License 2.0
0 stars 3 forks source link

Create image does not fail if the org is not specified #42

Closed whitlockjc closed 7 years ago

whitlockjc commented 7 years ago

We've got report that if you do not specify the --org flag for shipyardctl create image, you do not get an error and then a failure happens later in the request. This makes it harder to diagnose because you get an error like this: "You do not have admin permisison for imageSpace ..." Based on the customer usage, they were using -org instead of --org but no error ever happened.

noahdietz commented 7 years ago

Seems to be a problem with how cobra parses the flags. Because -o is valid shorthand for --org, supplying -org parses out into -o rg and fails as "You do not have admin permission for imageSpace rg".

Shall we just remove the shorthand?

whitlockjc commented 7 years ago

To me that is a bug in Cobra but before we file something, we should go see if there is something already explaining this as "as designed". I would hate to lose shorthand for this.

whitlockjc commented 7 years ago

Unfortunately, spf13/cobra is operating within the POSIX spec for parsing command line arguments. This means that there is no chance to have this handled for us and my initial thought is that any attempt to work around this would be equally broken. Here is the GitHub issue I raised with spf13/cobra to discuss the issue: https://github.com/spf13/cobra/issues/368