[GitHub] [openwhisk-cli] steven0711dong commented on a change in pull request #479: Trigger parameter issue
steven0711dong commented on a change in pull request #479: Trigger parameter issue URL: https://github.com/apache/openwhisk-cli/pull/479#discussion_r383543068 ## File path: commands/trigger.go ## @@ -601,3 +703,110 @@ func (t *Trigger) Update(Client *whisk.Client, args []string) error { return nil } + +//UpdateExtendedVersion only executes when users indicate to update triggers with --feed-param +//or --trigger-param flags. +func UpdateExtendedVersion(Client *whisk.Client, args []string, retTrigger *whisk.Trigger) error { + var fullFeedName string + var qualifiedName = new(QualifiedName) + var err error + + if qualifiedName, err = NewQualifiedName(args[0]); err != nil { + return NewQualifiedNameError(args[0], err) + } + + whisk.Debug(whisk.DbgInfo, "Parsing parameters: %#v\n", Flags.trigger.triggerParam) + triggerParameters, err := getJSONFromStrings(Flags.trigger.triggerParam, true) + if err != nil { + whisk.Debug(whisk.DbgError, "getJSONFromStrings(%#v, true) failed: %s\n", Flags.common.param, err) + errStr := wski18n.T("Invalid parameter argument '{{.param}}': {{.err}}", + map[string]interface{}{"param": fmt.Sprintf("%#v", Flags.common.param), "err": err}) + werr := whisk.MakeWskErrorFromWskError(errors.New(errStr), err, whisk.EXIT_CODE_ERR_GENERAL, whisk.DISPLAY_MSG, whisk.DISPLAY_USAGE) + return werr + } + + whisk.Debug(whisk.DbgInfo, "Parsing annotations: %#v\n", Flags.common.annotation) + annotations, err := getJSONFromStrings(Flags.common.annotation, true) + if err != nil { + whisk.Debug(whisk.DbgError, "getJSONFromStrings(%#v, true) failed: %s\n", Flags.common.annotation, err) + errStr := wski18n.T("Invalid annotation argument '{{.annotation}}': {{.err}}", + map[string]interface{}{"annotation": fmt.Sprintf("%#v", Flags.common.annotation), "err": err}) + werr := whisk.MakeWskErrorFromWskError(errors.New(errStr), err, whisk.EXIT_CODE_ERR_GENERAL, whisk.DISPLAY_MSG, whisk.DISPLAY_USAGE) + return werr + } + + trigger := { + Name:qualifiedName.GetEntityName(), + Parameters: triggerParameters.(whisk.KeyValueArr), + Annotations: annotations.(whisk.KeyValueArr), + } + + // Get full feed name from trigger get request as it is needed to get the feed + if retTrigger != nil && retTrigger.Annotations != nil { + fullFeedName = getValueString(retTrigger.Annotations, "feed") + } + + _, _, err = Client.Triggers.Insert(trigger, true) + if err != nil { + whisk.Debug(whisk.DbgError, "Client.Triggers.Insert(%+v,true) failed: %s\n", trigger, err) + errStr := wski18n.T("Unable to update trigger '{{.name}}': {{.err}}", + map[string]interface{}{"name": trigger.Name, "err": err}) + werr := whisk.MakeWskErrorFromWskError(errors.New(errStr), err, whisk.EXIT_CODE_ERR_GENERAL, whisk.DISPLAY_MSG, whisk.NO_DISPLAY_USAGE) + return werr + } + //if there is no feed attached to this trigger + if len(fullFeedName) < 1 { + //but user indicate feed parameter change, we issue error message. + if len(Flags.trigger.feedParam) > 0 { + whisk.Debug(whisk.DbgError, "trigger %+v is found but it does not contain a feed. \n", trigger) + err := errors.New("this trigger does not contain a feed") + errStr := wski18n.T(FEED_CONFIGURATION_FAILURE, map[string]interface{}{"feedname": qualifiedName.GetEntityName(), "err": err}) + werr := whisk.MakeWskErrorFromWskError(errors.New(errStr), err, whisk.EXIT_CODE_ERR_GENERAL, whisk.DISPLAY_MSG, whisk.NO_DISPLAY_USAGE) + return werr + } + } + + if len(fullFeedName) > 0 && feedParameterChanged(Flags.trigger.feedParam) { + //if there is feed, we invoke the action to configure the feed regardless any changes on feed parameters + fullTriggerName := fmt.Sprintf("/%s/%s", qualifiedName.GetNamespace(), qualifiedName.GetEntityName()) + Flags.trigger.feedParam = append(Flags.trigger.feedParam, getFormattedJSON(FEED_LIFECYCLE_EVENT, FEED_UPDATE)) + Flags.trigger.feedParam = append(Flags.trigger.feedParam, getFormattedJSON(FEED_TRIGGER_NAME, fullTriggerName)) + Flags.trigger.feedParam = append(Flags.trigger.feedParam, getFormattedJSON(FEED_AUTH_KEY, Client.Config.AuthToken)) + + // Invoke the specified feed action to configure the trigger feed + err = configureFeed(qualifiedName.GetEntityName(), fullFeedName, getParameters(Flags.trigger.feedParam,
[GitHub] [openwhisk-cli] steven0711dong commented on a change in pull request #479: Trigger parameter issue
steven0711dong commented on a change in pull request #479: Trigger parameter issue URL: https://github.com/apache/openwhisk-cli/pull/479#discussion_r383542772 ## File path: tests/src/test/scala/system/basic/WskCliBasicTests.scala ## @@ -491,6 +491,47 @@ class WskCliBasicTests extends TestHelpers with WskTestHelpers { wsk.trigger.list().stdout should include(triggerName) } + it should "return error message when updating feed param on trigger that contains no feed param" in withAssetCleaner( +wskprops) { (wp, assetHelper) => +val triggerName = withTimestamp("t1tor1") +val ns = wsk.namespace.whois() +val params = Map("a" -> "A".toJson) + +assetHelper.withCleaner(wsk.trigger, triggerName) { (trigger, _) => + trigger.create(triggerName, parameters = params) +} +wsk + .cli( +Seq("trigger", "update", triggerName, "-F", "feedParam", "feedParamVal", "--auth", wskprops.authKey) ++ wskprops.overrides, +expectedExitCode = ERROR_EXIT) + .stderr should include("this trigger does not contain a feed") + } + + it should "return error message when creating or updating feed with both --param and --trigger-param/--feed-param flags" in withAssetCleaner( +wskprops) { (wp, assetHelper) => +val triggerName = withTimestamp("t1tor1") +val ns = wsk.namespace.whois() + +var stderr = Review comment: I added a test for -P 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [openwhisk-cli] steven0711dong commented on a change in pull request #479: Trigger parameter issue
steven0711dong commented on a change in pull request #479: Trigger parameter issue URL: https://github.com/apache/openwhisk-cli/pull/479#discussion_r383542835 ## File path: commands/trigger.go ## @@ -397,11 +397,15 @@ func init() { triggerCreateCmd.Flags().StringSliceVarP(, "param", "p", []string{}, wski18n.T("parameter values in `KEY VALUE` format")) triggerCreateCmd.Flags().StringVarP(, "param-file", "P", "", wski18n.T("`FILE` containing parameter values in JSON format")) triggerCreateCmd.Flags().StringVarP(, "feed", "f", "", wski18n.T("trigger feed `ACTION_NAME`")) + triggerCreateCmd.Flags().StringSliceVarP(, "feed-param", "F", []string{}, wski18n.T("feed parameter values in `KEY VALUE` format")) Review comment: added 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [openwhisk-cli] steven0711dong commented on a change in pull request #479: Trigger parameter issue
steven0711dong commented on a change in pull request #479: Trigger parameter issue URL: https://github.com/apache/openwhisk-cli/pull/479#discussion_r383476638 ## File path: tests/src/test/scala/system/basic/WskCliBasicTests.scala ## @@ -491,6 +491,47 @@ class WskCliBasicTests extends TestHelpers with WskTestHelpers { wsk.trigger.list().stdout should include(triggerName) } + it should "return error message when updating feed param on trigger that contains no feed param" in withAssetCleaner( +wskprops) { (wp, assetHelper) => +val triggerName = withTimestamp("t1tor1") +val ns = wsk.namespace.whois() +val params = Map("a" -> "A".toJson) + +assetHelper.withCleaner(wsk.trigger, triggerName) { (trigger, _) => + trigger.create(triggerName, parameters = params) +} +wsk + .cli( +Seq("trigger", "update", triggerName, "-F", "feedParam", "feedParamVal", "--auth", wskprops.authKey) ++ wskprops.overrides, +expectedExitCode = ERROR_EXIT) + .stderr should include("this trigger does not contain a feed") + } + + it should "return error message when creating or updating feed with both --param and --trigger-param/--feed-param flags" in withAssetCleaner( Review comment: This test case is for both create and update. 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [openwhisk-cli] steven0711dong commented on a change in pull request #479: Trigger parameter issue
steven0711dong commented on a change in pull request #479: Trigger parameter issue URL: https://github.com/apache/openwhisk-cli/pull/479#discussion_r383471254 ## File path: commands/trigger.go ## @@ -547,15 +640,24 @@ func (t *Trigger) Update(Client *whisk.Client, args []string) error { retTrigger, httpResp, err := Client.Triggers.Get(qualifiedName.GetEntityName()) if err != nil && httpResp.StatusCode == 404 { - t.Create(Client, args) + if createErr := t.Create(Client, args); createErr != nil { Review comment: Correct. 1. If `trigger get` fails with 404, then we create the trigger. If creating the triggers fails, we have to report back to the user. Previously we do not report any error when we create trigger in update and that was a bug. 2. If `trigger get` fails with other reason, execution will fall into next else if, and we report the error message as well. 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [openwhisk-cli] steven0711dong commented on a change in pull request #479: Trigger parameter issue
steven0711dong commented on a change in pull request #479: Trigger parameter issue URL: https://github.com/apache/openwhisk-cli/pull/479#discussion_r383471254 ## File path: commands/trigger.go ## @@ -547,15 +640,24 @@ func (t *Trigger) Update(Client *whisk.Client, args []string) error { retTrigger, httpResp, err := Client.Triggers.Get(qualifiedName.GetEntityName()) if err != nil && httpResp.StatusCode == 404 { - t.Create(Client, args) + if createErr := t.Create(Client, args); createErr != nil { Review comment: Correct. 1. If `trigger get` fails with 404, then we create the trigger. If creating the triggers fails, we have to report back to the user. Previously we do not report any error when we create trigger in update and that was a bug. 2. If trigger fails with other reason, execution will fall into next else if, and we report the error message as well. 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [openwhisk-cli] steven0711dong commented on a change in pull request #479: Trigger parameter issue
steven0711dong commented on a change in pull request #479: Trigger parameter issue URL: https://github.com/apache/openwhisk-cli/pull/479#discussion_r383471254 ## File path: commands/trigger.go ## @@ -547,15 +640,24 @@ func (t *Trigger) Update(Client *whisk.Client, args []string) error { retTrigger, httpResp, err := Client.Triggers.Get(qualifiedName.GetEntityName()) if err != nil && httpResp.StatusCode == 404 { - t.Create(Client, args) + if createErr := t.Create(Client, args); createErr != nil { Review comment: Correct. 1. If trigger get fails with 404, then we create the trigger. If creating the triggers fails, we have to report back to the user. Previously we do not report any error when we create trigger in update and that was a bug. 2. If trigger fails with other reason, execution will fall into next else if, and we report the error message as well. 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [openwhisk-cli] steven0711dong commented on a change in pull request #479: Trigger parameter issue
steven0711dong commented on a change in pull request #479: Trigger parameter issue URL: https://github.com/apache/openwhisk-cli/pull/479#discussion_r378533246 ## File path: commands/trigger.go ## @@ -436,47 +442,108 @@ 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) + //Within this if statement, we process users' trigger command using the old way. Review comment: I can try to separate the 'old way' and 'new way' into two different functions. 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [openwhisk-cli] steven0711dong commented on a change in pull request #479: Trigger parameter issue
steven0711dong commented on a change in pull request #479: Trigger parameter issue URL: https://github.com/apache/openwhisk-cli/pull/479#discussion_r378531063 ## File path: commands/trigger.go ## @@ -436,47 +442,108 @@ 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) + //Within this if statement, we process users' trigger command using the old way. + if userIndicatesToUseOldTriggerCommand() { + //if user also issued new trigger command then we stop execution + if userIssuedNewTriggerCmd() { + return nil + } + // 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(Flags.common.param, additionalFeedParams...), feedQualifiedName == nil, false) + + trigger := { + Name:triggerName.GetEntityName(), + Annotations: annotations.(whisk.KeyValueArr), + } + + if feedQualifiedName == nil { + // parameters are only attached to the trigger in there is no feed, otherwise + // parameters are passed to the feed instead + trigger.Parameters = parameters.(whisk.KeyValueArr) + } + + createOrUpdate(Client, triggerName, trigger, false) + + // Invoke the specified feed action to configure the trigger feed + if feedQualifiedName != nil { + res, err := invokeAction(*feedQualifiedName, parameters, true, false) + if err != nil { + whisk.Debug(whisk.DbgError, "Failed configuring feed '%s' failed: %s\n", feedQualifiedName.GetFullQualifiedName(), err) + + // TODO: should we do this at all? Keeping for now. + printFailedBlockingInvocationResponse(*feedQualifiedName, false, res, err) + + reason := wski18n.T(FEED_CONFIGURATION_FAILURE, map[string]interface{}{"feedname": feedQualifiedName.GetFullQualifiedName(), "err": err}) + errStr := wski18n.T("Unable to create trigger '{{.name}}': {{.err}}", + map[string]interface{}{"name": trigger.Name, "err": reason}) + werr := whisk.MakeWskErrorFromWskError(errors.New(errStr), err, whisk.EXIT_CODE_ERR_GENERAL, whisk.DISPLAY_MSG, whisk.NO_DISPLAY_USAGE) + + // Delete trigger that was created for this feed + err = deleteTrigger(triggerName.GetEntityName()) + if err != nil { + whisk.Debug(whisk.DbgWarn, "Ignoring deleteTrigger(%s) failure: %s\n", triggerName.GetEntityName(), err) + } + + return werr + } else { + whisk.Debug(whisk.DbgInfo, "Successfully configured trigger feed via feed action '%s'\n", Flags.common.feed) + + // preserve existing behavior where output of feed activation is emitted to console + printInvocationMsg(*feedQualifiedName, true, true, res, color.Output) + } + } + +
[GitHub] [openwhisk-cli] steven0711dong commented on a change in pull request #479: Trigger parameter issue
steven0711dong commented on a change in pull request #479: Trigger parameter issue URL: https://github.com/apache/openwhisk-cli/pull/479#discussion_r376517816 ## 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: I created two functions so that both create and update could use. Some other variables such as params, feed params do exist in both functions but are created differently and the creation depends on users' intention on how to issue trigger command(old way and new way). So it might make things more complicated to create functions out of duplicate code. I have to admit that after adding the new flags, both functions become bigger but I think it might be a good idea to separate execution path for the old way of creating trigger from the new way so they do not get lumped 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [openwhisk-cli] steven0711dong commented on a change in pull request #479: Trigger parameter issue
steven0711dong commented on a change in pull request #479: Trigger parameter issue URL: https://github.com/apache/openwhisk-cli/pull/479#discussion_r376517816 ## 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: I created two functions so that both create and update could use. Some other variables such as params, feed params do exist in both functions but are created differently and the creation depends on users' intention on how to issue trigger command(old way and new way). So it might make things more complicated to create functions out of duplicate code. I have to admit that after adding the new flags, both functions become bigger but I think it might be a good idea to separate execution path for the old way of creating trigger from the new way so they do not get lumped together. I'll update the PR this afternoon. 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [openwhisk-cli] steven0711dong commented on a change in pull request #479: Trigger parameter issue
steven0711dong commented on a change in pull request #479: Trigger parameter issue URL: https://github.com/apache/openwhisk-cli/pull/479#discussion_r376440012 ## 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: Yeah, if users want to create a trigger using the new way. They will create trigger parameters using --trigger-param flag and create feed parameters using --feed-param flag. They just cannot combine --param with --feed-param or --trigger-param. The meaning is ambiguous. So we issue an error here. 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [openwhisk-cli] steven0711dong commented on a change in pull request #479: Trigger parameter issue
steven0711dong commented on a change in pull request #479: Trigger parameter issue URL: https://github.com/apache/openwhisk-cli/pull/479#discussion_r375358637 ## File path: commands/commands.go ## @@ -181,17 +184,34 @@ func parseArgs(args []string) ([]string, []string, []string, error) { map[string]interface{}{"err": whiskErr}) whiskErr = whisk.MakeWskError(errors.New(errMsg), whisk.EXIT_CODE_ERR_GENERAL, whisk.DISPLAY_MSG, whisk.DISPLAY_USAGE) - return nil, nil, nil, whiskErr + return nil, nil, nil, nil, nil, whiskErr } } else if args[i] == "-a" || args[i] == "--annotation" { + fmt.Println("4") Review comment: oops.. 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [openwhisk-cli] steven0711dong commented on a change in pull request #479: Trigger parameter issue
steven0711dong commented on a change in pull request #479: Trigger parameter issue URL: https://github.com/apache/openwhisk-cli/pull/479#discussion_r372038437 ## File path: commands/commands.go ## @@ -191,7 +192,17 @@ func parseArgs(args []string) ([]string, []string, []string, error) { map[string]interface{}{"err": whiskErr}) whiskErr = whisk.MakeWskError(errors.New(errMsg), whisk.EXIT_CODE_ERR_GENERAL, whisk.DISPLAY_MSG, whisk.DISPLAY_USAGE) - return nil, nil, nil, whiskErr + return nil, nil, nil, nil, whiskErr + } + } else if args[i] == "-fp" || args[i] == "--feed-param" { + feedParamArgs, args, whiskErr = getKeyValueArgs(args, i, feedParamArgs) + if whiskErr != nil { + whisk.Debug(whisk.DbgError, "getKeyValueArgs(%#v, %d) failed: %s\n", args, i, whiskErr) + errMsg := wski18n.T("The parameter arguments are invalid: {{.err}}", Review comment: I realize that it is sufficient to rely on error message produced by getKeyValueArgs. So I removed the unnecessary error string. 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: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [openwhisk-cli] steven0711dong commented on a change in pull request #479: Trigger parameter issue
steven0711dong commented on a change in pull request #479: Trigger parameter issue URL: https://github.com/apache/openwhisk-cli/pull/479#discussion_r371968929 ## File path: commands/trigger.go ## @@ -594,10 +579,42 @@ func (t *Trigger) Update(Client *whisk.Client, args []string) error { } } + //if there is no feed attached to this trigger + if len(fullFeedName) < 1 { + //but user indicate feed parameter change, we issue error message. + if len(Flags.trigger.feedParam) > 0 { + whisk.Debug(whisk.DbgError, "trigger %+v is found but it does not contain a feed. \n", trigger) + errStr := wski18n.T("triggerDoesNotContainFeed", map[string]interface{}{"name": qualifiedName.GetEntityName()}) Review comment: `triggerDoesNotContainFeed` represents a very specific message that tells users they've run into a specific situation that will results to error. This happens when they tries to update feed params when the trigger contains no feed. I cannot find any constant in messages.go file that represents this. There is only one constant that's relevant, which is `FEED_CONFIGURATION_FAILURE`, but this is too broad and general error message. 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: us...@infra.apache.org With regards, Apache Git Services