dubee commented on a change in pull request #479: Trigger parameter issue
URL: https://github.com/apache/openwhisk-cli/pull/479#discussion_r375344993
##########
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
Review comment:
Does duplicate code exist in create and update? If so it'd be better to
create functions out of the duplicate code to reduce complexity.
----------------------------------------------------------------
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