dubee commented on a change in pull request #479: Trigger parameter issue
URL: https://github.com/apache/openwhisk-cli/pull/479#discussion_r375341360
 
 

 ##########
 File path: commands/trigger.go
 ##########
 @@ -436,47 +440,118 @@ func (t *Trigger) Create(Client *whisk.Client, args 
[]string) error {
                return NewQualifiedNameError(args[0], err)
        }
 
-       paramArray := Flags.common.param
        annotationArray := Flags.common.annotation
-       feedParam := Flags.common.feed
        authToken := Client.Config.AuthToken
 
        // if a feed is specified, create additional parameters which must be 
passed to the feed
-       feedName, feedParams := feedParameters(feedParam, FEED_CREATE, 
triggerName, authToken)
-       // the feed receives all the parameters that are specified on the 
command line so we merge
-       // the feed lifecycle parameters with the command line ones
-       parameters := getParameters(append(paramArray, feedParams...), feedName 
== nil, false)
+       feedQualifiedName, additionalFeedParams := 
feedParameters(Flags.common.feed, FEED_CREATE, triggerName, authToken)
 
        // if a feed is specified, add feed annotation the annotations declared 
on the command line
        // TODO: add test to ensure that generated annotation has precedence
-       if feedName != nil {
-               annotationArray = append(annotationArray, 
getFormattedJSON("feed", feedName.GetFullQualifiedName()))
+       if feedQualifiedName != nil {
+               annotationArray = append(annotationArray, 
getFormattedJSON("feed", feedQualifiedName.GetFullQualifiedName()))
        }
        annotations := getParameters(annotationArray, true, true)
 
+       //simplestTrigger indicates user are creating a trigger without any 
feed or parameters
+       simplestTrigger := len(Flags.trigger.feedParam) == 0 && 
len(Flags.common.param) == 0 && len(Flags.trigger.triggerParam) == 0
+
+       //if users are 1. creating a trigger without any feed or parameters
+       //             2. creating a trigger using --param flag
+       //then we use the old way to create the trigger.
+       if len(Flags.common.param) > 0 || simplestTrigger {
+               if len(Flags.trigger.feedParam) > 0 || 
len(Flags.trigger.triggerParam) > 0 {
+                       whisk.Debug(whisk.DbgError, "User tries to mix use of 
--param with --feed-param and --trigger-param")
 
 Review comment:
   Is there a use case for the user trying to use trigger parameters and feed 
parameters together?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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

Reply via email to