-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Display appropriate message for trigger fire when 204 is returned #311
base: master
Are you sure you want to change the base?
Conversation
598219f
to
b83acb7
Compare
commands/trigger.go
Outdated
@@ -92,13 +92,24 @@ var triggerFireCmd = &cobra.Command{ | |||
return werr | |||
} | |||
|
|||
if resp.StatusCode == 204 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if resp.StatusCode == http.StatusNoContent {
wski18n/resources/en_US.all.json
Outdated
@@ -625,6 +625,10 @@ | |||
"id": "{{.ok}} triggered /{{.namespace}}/{{.name}} with id {{.id}}\n", | |||
"translation": "{{.ok}} triggered /{{.namespace}}/{{.name}} with id {{.id}}\n" | |||
}, | |||
{ | |||
"id": "trigger /{{.namespace}}/{{.name}} did not fire as it is not associated with an active rule(s)\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think rules(s)
can be changed to rule
. only one active rule is needed.
} | ||
|
||
val rr = wsk.trigger.fire(triggerName) | ||
val ns = wsk.namespace.whois() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not used?
"namespace": boldString(qualifiedName.GetNamespace()), | ||
"name": boldString(qualifiedName.GetEntityName())})) | ||
|
||
return nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
up for discussion... is this situation considered an error (i.e. non-zero exit code, stderr)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mdeuser, I believe we agreed to return a non-zero exit code here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dubee yeah.. that's what you and i agreed upon. was looking if anyone had an opposite argument :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
which exit code would you return?
@@ -92,13 +93,24 @@ var triggerFireCmd = &cobra.Command{ | |||
return werr | |||
} | |||
|
|||
if resp.StatusCode == http.StatusNoContent { | |||
fmt.Fprintf(color.Output, | |||
wski18n.T("trigger /{{.namespace}}/{{.name}} did not fire as it is not associated with an active rule\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest for all new message and to start transitioning these message ids to constants - see for example baa07f0.
@@ -92,13 +93,24 @@ var triggerFireCmd = &cobra.Command{ | |||
return werr | |||
} | |||
|
|||
if resp.StatusCode == http.StatusNoContent { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest starting to add go unit tests as well for such changes as it will vector toward better factoring of the code. For example a unit test that mocks an HTTP response and confirms returning the expected message and CLI code.
bb32c44
to
3031300
Compare
When a trigger without active or associated rule(s) is fired, an activation ID is not returned from an OpenWhisk server. These changes display an appropriate message when such an scenario occurs.
Closes #301