dubee commented on a change in pull request #319: Refactor action invoke
functions
URL:
https://github.com/apache/incubator-openwhisk-cli/pull/319#discussion_r195306011
##########
File path: commands/action.go
##########
@@ -172,65 +171,79 @@ var actionInvokeCmd = &cobra.Command{
return NewQualifiedNameError(args[0], err)
}
- Client.Namespace = qualifiedName.GetNamespace()
- paramArgs = Flags.common.param
+ parameters = getParameters(Flags.common.param, false, false)
+ blocking := Flags.common.blocking || Flags.action.result
+ resultOnly := Flags.action.result
+ header := !resultOnly
- if len(paramArgs) > 0 {
- if parameters, err = getJSONFromStrings(paramArgs,
false); err != nil {
- return getJSONFromStringsParamError(paramArgs,
false, err)
- }
- }
- if Flags.action.result {
- Flags.common.blocking = true
- }
-
- res, _, err := Client.Actions.Invoke(
- qualifiedName.GetEntityName(),
+ res, err := invokeAction(
+ *qualifiedName,
parameters,
- Flags.common.blocking,
- Flags.action.result)
+ blocking,
+ resultOnly)
- return handleInvocationResponse(*qualifiedName, parameters,
res, err)
+ return printInvocationResponse(*qualifiedName, blocking,
header, res, err)
},
}
-func handleInvocationResponse(
+func invokeAction(
qualifiedName QualifiedName,
parameters interface{},
+ blocking bool,
+ result bool) (map[string]interface{}, error) {
+ // TODO remove all global modifiers
Review comment:
Which global variables?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services