Remove 'kinds' from CLI; defer to backend.#2053
Conversation
eab40f1 to
950e318
Compare
|
pg2/1265 🔵 |
|
@dubeejw could put some 👀 on this when you have a chance |
| actionUpdateCmd.Flags().BoolVar(&flags.action.copy, "copy", false, wski18n.T("treat ACTION as the name of an existing action")) | ||
| actionUpdateCmd.Flags().BoolVar(&flags.action.sequence, "sequence", false, wski18n.T("treat ACTION as comma separated sequence of actions to invoke")) | ||
| actionUpdateCmd.Flags().StringVar(&flags.action.kind, "kind", "", wski18n.T("the `KIND` of the action runtime (example: swift:3, nodejs:6)")) | ||
| actionUpdateCmd.Flags().StringVar(&flags.action.kind, "kind", "", wski18n.T("the `KIND` of the action runtime (example: swift:default, nodejs:default)")) |
There was a problem hiding this comment.
You will need to update the file containing externalized strings for this change. See tools/cli/go-whisk-cli/wski18n/resources/en_US.all.json.
| actionCreateCmd.Flags().BoolVar(&flags.action.copy, "copy", false, wski18n.T("treat ACTION as the name of an existing action")) | ||
| actionCreateCmd.Flags().BoolVar(&flags.action.sequence, "sequence", false, wski18n.T("treat ACTION as comma separated sequence of actions to invoke")) | ||
| actionCreateCmd.Flags().StringVar(&flags.action.kind, "kind", "", wski18n.T("the `KIND` of the action runtime (example: swift:3, nodejs:6)")) | ||
| actionCreateCmd.Flags().StringVar(&flags.action.kind, "kind", "", wski18n.T("the `KIND` of the action runtime (example: swift:default, nodejs:default)")) |
There was a problem hiding this comment.
See comment about externalized strings.
| action.Exec.Kind = "nodejs" | ||
| } else if flags.action.kind == "python" { | ||
| action.Exec.Kind = "python" | ||
| if len(flags.action.kind) > 0 { |
There was a problem hiding this comment.
If a user enters a --kind value that is not supported, will the backend return an error when the request is sent for processing? If so, is there a test?
It would be fantastic if you can create a function that handles all the --kind processing and reference that in parseAction().
There was a problem hiding this comment.
Yes it will:
> wsk action create foo t.js --kind foobar
error: Unable to create action: The request content was malformed:
kind 'foobar' not in Set(swift:3, nodejs, blackbox, java, sequence, nodejs:6, python, swift) (code 1206)
Run 'wsk --help' for usage.
I don't understand the second part of the comment re parseAction.
There was a problem hiding this comment.
Essentially I wanted this action.Exec, err = getExec(args[1]) to reduce the amount of code in parseAction.
There was a problem hiding this comment.
Just to be safe, you may also want to pass flags.action.kind, and flags.action.docker to the new method since those are globals and could be accidentally be overwritten. Ex: getExec(args[1], flags.action.kind, flags.action.docker)
There was a problem hiding this comment.
thanks for the explanation and pr.
There was a problem hiding this comment.
OK to stage the refactoring to a separate pr so that we can enable python 3?
There was a problem hiding this comment.
It can be done later if necessary.
176299e to
02d18b4
Compare
|
@csantanapr, LGTM! |
|
I'll re pg. |
31b6f40 to
69b6b5f
Compare
60a278d to
d240ce3
Compare
|
pg4/93 good to merge. |
|
@dubeejw can you approve the review record if it still Looks good to you? |
|
I think it's good to merge. I don't have write access to officially approve :). |
|
@dubeejw You don't need write access to officially approve, you see a green button on this page |
* Remove 'kinds' from CLI; defer to backend. * Fix messages. * Add cli test for unknown kind. * Move Kind Process to its Own Method to Declutter ParseAction (apache#9) * pass flags to getExec.
* Remove 'kinds' from CLI; defer to backend. * Fix messages. * Add cli test for unknown kind. * Move Kind Process to its Own Method to Declutter ParseAction (apache#9) * pass flags to getExec.
* Remove 'kinds' from CLI; defer to backend. * Fix messages. * Add cli test for unknown kind. * Move Kind Process to its Own Method to Declutter ParseAction (apache#9) * pass flags to getExec.
* Remove 'kinds' from CLI; defer to backend. * Fix messages. * Add cli test for unknown kind. * Move Kind Process to its Own Method to Declutter ParseAction (apache#9) * pass flags to getExec.
* Remove 'kinds' from CLI; defer to backend. * Fix messages. * Add cli test for unknown kind. * Move Kind Process to its Own Method to Declutter ParseAction (apache#9) * pass flags to getExec.
* Remove 'kinds' from CLI; defer to backend. * Fix messages. * Add cli test for unknown kind. * Move Kind Process to its Own Method to Declutter ParseAction (apache#9) * pass flags to getExec.
* Remove 'kinds' from CLI; defer to backend. * Fix messages. * Add cli test for unknown kind. * Move Kind Process to its Own Method to Declutter ParseAction (apache#9) * pass flags to getExec.
* Remove 'kinds' from CLI; defer to backend. * Fix messages. * Add cli test for unknown kind. * Move Kind Process to its Own Method to Declutter ParseAction (apache#9) * pass flags to getExec.
* Remove 'kinds' from CLI; defer to backend. * Fix messages. * Add cli test for unknown kind. * Move Kind Process to its Own Method to Declutter ParseAction (apache#9) * pass flags to getExec.
* Remove 'kinds' from CLI; defer to backend. * Fix messages. * Add cli test for unknown kind. * Move Kind Process to its Own Method to Declutter ParseAction (apache#9) * pass flags to getExec.
* Remove 'kinds' from CLI; defer to backend. * Fix messages. * Add cli test for unknown kind. * Move Kind Process to its Own Method to Declutter ParseAction (apache#9) * pass flags to getExec.
* Remove 'kinds' from CLI; defer to backend. * Fix messages. * Add cli test for unknown kind. * Move Kind Process to its Own Method to Declutter ParseAction (apache#9) * pass flags to getExec.
This PR is to permit progress on adding python:3 support.
Further CLI enhancements related to kind-awareness planned for/after #1980; in particular
wsk property getto list supported kinds for deployment.FYI @cclauss.