If you edit a rule, it becomes disabled in OpenWhisk. It should not change the status of the rule.
The behavior described here seems to be originating from the backend not the CLI.
@dubeejw thanks for checking.
This is the location of the inactive state setting for the update https://github.com/openwhisk/openwhisk/blob/master/core/controller/src/main/scala/whisk/core/controller/Rules.scala#L303.
I believe this is leftover from the "locks" we had in place, where you couldn't do anything with a rule if its active.
Indeed. Should updating a rule always put it in active state? (Would be consistent with create/activate.)
I would argue that the status shouldn't change - period. However if you decide to activate it, please make the CLI report this with a message. If a dev forgets the updating will also turn it on, a warning will be helpful.
TLDR; Let only the user change the active state of the rule, system should not be changing it when being updated.
I would argue that it's useful for staging or swapping deploying if a user wants to use rules that a rule's active state remains unchange when it's being updated.
@markusthoemmes @rabbah is this a good candidate for one of you to write some sudo code, for someone to pick up and drive it?
This has hit users using the framework.
https://github.com/serverless/serverless-openwhisk/issues/55
Running wsk rule update <ruleName> <trigger> <action> -v shows a PUT request with the body: {{"name":"<rule>","status":"","trigger":"/_/<trigger>","action":"/_/<action>"}}. We can see status gets sent as a falsy value, which was my first thought as to what would be causing the problem. To make this even more confusing, the response that comes back shows the rule with a status of active.
Even after rebuilding the CLI to send status: active, Scala will still return a response that contains an "active" status rule, even though GETing the rule shows that it is still inactive, which pretty much confirms @dubeejw thoughts that this is purely a Scala controller issue (though the initial CLI update/PUT request should still send the current status of the rule instead of null).
It looks like here: https://github.com/apache/incubator-openwhisk/blob/master/core/controller/src/main/scala/whisk/core/controller/Rules.scala#L85
that no matter what the status actually is, we just send back an active status in the response, even though that may not be the actual status of the rule.
To update the status you must POST to the rule.
Most helpful comment
I would argue that the status shouldn't change - period. However if you decide to activate it, please make the CLI report this with a message. If a dev forgets the updating will also turn it on, a warning will be helpful.