You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2018/06/14 10:26:30 UTC

[GitHub] rabbah commented on a change in pull request #319: Refactor action invoke functions

rabbah commented on a change in pull request #319: Refactor action invoke functions 
URL: https://github.com/apache/incubator-openwhisk-cli/pull/319#discussion_r195372768
 
 

 ##########
 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:
   My intention is to remove all Client.<field> and Flags.<field> assignments where for the latter beyond the initial parsing should be viewed as immutable. 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services