apache / openwhisk-wskdeploy

Apache OpenWhisk utility for deploying and managing OpenWhisk projects and packages
https://openwhisk.apache.org/
Apache License 2.0
77 stars 74 forks source link

redeploy manifest with rule leaves as disables #708

Closed ScottChapman closed 6 years ago

ScottChapman commented 6 years ago

When I first deployed my app (which included a rule) it was enabled.

Doing another deploy (possibly an undeploy first) left the rule as disabled/

pritidesai commented 6 years ago

Hi @ScottChapman please provide me with your manifest if possible.

Here I tried to deploy/undeploy/deploy again and rule was left as active:

 ./wskdeploy  -p tests/src/integration/helloworld/
Info: The API host is [http://192.168.33.13:10001], from .wskprops.
Info: The auth key is set, from .wskprops.
Info: The namespace is [guest], from .wskprops.
Warning: The mandatory key [package version] should be set. Using default value [0.0.1]...
Warning: The value for key [package version] is not saved in the current version of wskdeploy.
Warning: The mandatory key [package license] should be set. Using default value [unlicensed]...
Warning: The value for key [package version] is not saved in the current version of wskdeploy.
Info: Deploying package [IntegrationTestHelloWorld] ...
Info: package [IntegrationTestHelloWorld] has been successfully deployed.

Info: Deploying action [IntegrationTestHelloWorld/helloNodejs] ...
Info: action [IntegrationTestHelloWorld/helloNodejs] has been successfully deployed.

Info: Deploying action [IntegrationTestHelloWorld/helloJava] ...
Info: action [IntegrationTestHelloWorld/helloJava] has been successfully deployed.

Info: Deploying action [IntegrationTestHelloWorld/helloPython] ...
Info: action [IntegrationTestHelloWorld/helloPython] has been successfully deployed.

Info: Deploying action [IntegrationTestHelloWorld/helloSwift] ...
Info: action [IntegrationTestHelloWorld/helloSwift] has been successfully deployed.

Info: Deploying action [IntegrationTestHelloWorld/hello-world-series] ...
Info: action [IntegrationTestHelloWorld/hello-world-series] has been successfully deployed.

Info: Deploying trigger [triggerHelloworld] ...
Info: trigger [triggerHelloworld] has been successfully deployed.

Info: Deploying rule [ruleMappingHelloworld] ...
Info: rule [ruleMappingHelloworld] has been successfully deployed.

Success: Deployment completed successfully.

wsk list
Entities in namespace: guest
packages
/guest/IntegrationTestHelloWorld                                       private
actions
/guest/IntegrationTestHelloWorld/hello-world-series                    private sequence
/guest/IntegrationTestHelloWorld/helloSwift                            private swift:3.1.1
/guest/IntegrationTestHelloWorld/helloPython                           private python
/guest/IntegrationTestHelloWorld/helloJava                             private java
/guest/IntegrationTestHelloWorld/helloNodejs                           private nodejs:6
triggers
/guest/triggerHelloworld                                               private
rules
/guest/ruleMappingHelloworld                                           private              active

./wskdeploy undeploy -p tests/src/integration/helloworld/
Info: The API host is [http://192.168.33.13:10001], from .wskprops.
Info: The auth key is set, from .wskprops.
Info: The namespace is [guest], from .wskprops.
Warning: The mandatory key [package version] should be set. Using default value [0.0.1]...
Warning: The value for key [package version] is not saved in the current version of wskdeploy.
Warning: The mandatory key [package license] should be set. Using default value [unlicensed]...
Warning: The value for key [package version] is not saved in the current version of wskdeploy.
Info: Undeploying rule [ruleMappingHelloworld] ...
Info: rule [ruleMappingHelloworld] has been successfully undeployed.

Info: Undeploying trigger [triggerHelloworld] ...
Info: trigger [triggerHelloworld] has been successfully undeployed.

Info: Undeploying action [IntegrationTestHelloWorld/hello-world-series] ...
Info: action [IntegrationTestHelloWorld/hello-world-series] has been successfully undeployed.

Info: Undeploying action [IntegrationTestHelloWorld/helloNodejs] ...
Info: action [IntegrationTestHelloWorld/helloNodejs] has been successfully undeployed.

Info: Undeploying action [IntegrationTestHelloWorld/helloJava] ...
Info: action [IntegrationTestHelloWorld/helloJava] has been successfully undeployed.

Info: Undeploying action [IntegrationTestHelloWorld/helloPython] ...
Info: action [IntegrationTestHelloWorld/helloPython] has been successfully undeployed.

Info: Undeploying action [IntegrationTestHelloWorld/helloSwift] ...
Info: action [IntegrationTestHelloWorld/helloSwift] has been successfully undeployed.

Info: Undeploying package [IntegrationTestHelloWorld] ...
Info: package [IntegrationTestHelloWorld] has been successfully undeployed.

Success: Undeployment completed successfully.

wsk list
Entities in namespace: guest
packages
actions
triggers
rules

./wskdeploy  -p tests/src/integration/helloworld/
Info: The API host is [http://192.168.33.13:10001], from .wskprops.
Info: The auth key is set, from .wskprops.
Info: The namespace is [guest], from .wskprops.
Warning: The mandatory key [package version] should be set. Using default value [0.0.1]...
Warning: The value for key [package version] is not saved in the current version of wskdeploy.
Warning: The mandatory key [package license] should be set. Using default value [unlicensed]...
Warning: The value for key [package version] is not saved in the current version of wskdeploy.
Info: Deploying package [IntegrationTestHelloWorld] ...
Info: package [IntegrationTestHelloWorld] has been successfully deployed.

Info: Deploying action [IntegrationTestHelloWorld/helloPython] ...
Info: action [IntegrationTestHelloWorld/helloPython] has been successfully deployed.

Info: Deploying action [IntegrationTestHelloWorld/helloSwift] ...
Info: action [IntegrationTestHelloWorld/helloSwift] has been successfully deployed.

Info: Deploying action [IntegrationTestHelloWorld/helloNodejs] ...
Info: action [IntegrationTestHelloWorld/helloNodejs] has been successfully deployed.

Info: Deploying action [IntegrationTestHelloWorld/helloJava] ...
Info: action [IntegrationTestHelloWorld/helloJava] has been successfully deployed.

Info: Deploying action [IntegrationTestHelloWorld/hello-world-series] ...
Info: action [IntegrationTestHelloWorld/hello-world-series] has been successfully deployed.

Info: Deploying trigger [triggerHelloworld] ...
Info: trigger [triggerHelloworld] has been successfully deployed.

Info: Deploying rule [ruleMappingHelloworld] ...
Info: rule [ruleMappingHelloworld] has been successfully deployed.

Success: Deployment completed successfully.

wsk list
Entities in namespace: guest
packages
/guest/IntegrationTestHelloWorld                                       private
actions
/guest/IntegrationTestHelloWorld/hello-world-series                    private sequence
/guest/IntegrationTestHelloWorld/helloJava                             private java
/guest/IntegrationTestHelloWorld/helloNodejs                           private nodejs:6
/guest/IntegrationTestHelloWorld/helloSwift                            private swift:3.1.1
/guest/IntegrationTestHelloWorld/helloPython                           private python
triggers
/guest/triggerHelloworld                                               private
rules
/guest/ruleMappingHelloworld                                           private              active
ScottChapman commented 6 years ago

Let me see how I can reproduce.

ScottChapman commented 6 years ago

OK, so what I noticed is if I re-deploy (don't undeploy first) my rules end up inactive:

**scotts-mbp:Dumper scottchapman$ bx wsk list**
Entities in namespace: default
packages
/scottchapman@us.ibm.com_WskDeploy/WatsonWorkspaceDumper               private
/scottchapman@us.ibm.com_WskDeploy/EchoApp                             private
/scottchapman@us.ibm.com_WskDeploy/WatsonWorkspace                     private
/scottchapman@us.ibm.com_WskDeploy/EchoAction                          private
actions
/scottchapman@us.ibm.com_WskDeploy/WatsonWorkspaceDumper/ActionSelectedDumper private nodejs:8
/scottchapman@us.ibm.com_WskDeploy/WatsonWorkspaceDumper/OthersEventDumper private nodejs:8
/scottchapman@us.ibm.com_WskDeploy/WatsonWorkspaceDumper/OwnEventDumper private nodejs:8
/scottchapman@us.ibm.com_WskDeploy/WatsonWorkspaceDumper/ButtonSelectedDumper private nodejs:8
/scottchapman@us.ibm.com_WskDeploy/EchoApp/EchoAppSequence             private sequence
/scottchapman@us.ibm.com_WskDeploy/EchoApp/Echo                        private nodejs:8
/scottchapman@us.ibm.com_WskDeploy/WatsonWorkspace/Webhook             private nodejs:8
/scottchapman@us.ibm.com_WskDeploy/WatsonWorkspace/TargetedMessage     private nodejs:8
/scottchapman@us.ibm.com_WskDeploy/WatsonWorkspace/SendMessage         private nodejs:8
/scottchapman@us.ibm.com_WskDeploy/WatsonWorkspace/GraphQL             private nodejs:8
/scottchapman@us.ibm.com_WskDeploy/WatsonWorkspace/Token               private nodejs:8
/scottchapman@us.ibm.com_WskDeploy/EchoAction/Echo                     private nodejs:8
triggers
/scottchapman@us.ibm.com_WskDeploy/WWActionSelected                    private
/scottchapman@us.ibm.com_WskDeploy/WWOthersEvent                       private
/scottchapman@us.ibm.com_WskDeploy/WWOwnEvent                          private
/scottchapman@us.ibm.com_WskDeploy/WWButtonSelected                    private
rules
/scottchapman@us.ibm.com_WskDeploy/ActionSelectedRule                  private              active
/scottchapman@us.ibm.com_WskDeploy/OthersEventRule                     private              active
/scottchapman@us.ibm.com_WskDeploy/OwnEventRule                        private              active
/scottchapman@us.ibm.com_WskDeploy/ButtonSelectedEventRule             private              active
/scottchapman@us.ibm.com_WskDeploy/EchoRule                            private              active
**scotts-mbp:Dumper scottchapman$ wskdeploy**
Info: The API host is openwhisk.ng.bluemix.net, from .wskprops.
Info: The auth key is set, from .wskprops.
Info: The namespace is _, from .wskprops.
Success: Deployment completed successfully.
**scotts-mbp:Dumper scottchapman$ bx wsk list**
Entities in namespace: default
packages
/scottchapman@us.ibm.com_WskDeploy/WatsonWorkspaceDumper               private
/scottchapman@us.ibm.com_WskDeploy/EchoApp                             private
/scottchapman@us.ibm.com_WskDeploy/WatsonWorkspace                     private
/scottchapman@us.ibm.com_WskDeploy/EchoAction                          private
actions
/scottchapman@us.ibm.com_WskDeploy/WatsonWorkspaceDumper/OthersEventDumper private nodejs:8
/scottchapman@us.ibm.com_WskDeploy/WatsonWorkspaceDumper/OwnEventDumper private nodejs:8
/scottchapman@us.ibm.com_WskDeploy/WatsonWorkspaceDumper/ButtonSelectedDumper private nodejs:8
/scottchapman@us.ibm.com_WskDeploy/WatsonWorkspaceDumper/ActionSelectedDumper private nodejs:8
/scottchapman@us.ibm.com_WskDeploy/EchoApp/EchoAppSequence             private sequence
/scottchapman@us.ibm.com_WskDeploy/EchoApp/Echo                        private nodejs:8
/scottchapman@us.ibm.com_WskDeploy/WatsonWorkspace/Webhook             private nodejs:8
/scottchapman@us.ibm.com_WskDeploy/WatsonWorkspace/TargetedMessage     private nodejs:8
/scottchapman@us.ibm.com_WskDeploy/WatsonWorkspace/SendMessage         private nodejs:8
/scottchapman@us.ibm.com_WskDeploy/WatsonWorkspace/GraphQL             private nodejs:8
/scottchapman@us.ibm.com_WskDeploy/WatsonWorkspace/Token               private nodejs:8
/scottchapman@us.ibm.com_WskDeploy/EchoAction/Echo                     private nodejs:8
triggers
/scottchapman@us.ibm.com_WskDeploy/WWActionSelected                    private
/scottchapman@us.ibm.com_WskDeploy/WWOthersEvent                       private
/scottchapman@us.ibm.com_WskDeploy/WWOwnEvent                          private
/scottchapman@us.ibm.com_WskDeploy/WWButtonSelected                    private
rules
/scottchapman@us.ibm.com_WskDeploy/ActionSelectedRule                  private              inactive
/scottchapman@us.ibm.com_WskDeploy/OthersEventRule                     private              inactive
/scottchapman@us.ibm.com_WskDeploy/OwnEventRule                        private              inactive
/scottchapman@us.ibm.com_WskDeploy/ButtonSelectedEventRule             private              inactive
/scottchapman@us.ibm.com_WskDeploy/EchoRule                            private              active
scotts-mbp:Dumper scottchapman$ 
pritidesai commented 6 years ago

Yup i can reproduce it now, its deploy followed by deploy, looking into it ... thanks @ScottChapman

pritidesai commented 6 years ago

I am noticing the same behavior with wsk with this sequence of operation:

wsk rule create R1 ...
wsk rule update R1 ...

and

wsk rule update R1 ...
wsk rule update R1 ...

looking into it ...

csantanapr commented 6 years ago

This is a problem in the backend being fix by @dubeejw https://github.com/apache/incubator-openwhisk/pull/3254

pritidesai commented 6 years ago

:( @csantanapr I didn't check your comment here, ended up debugging it :(

yup, indeed its a backend issue:

r1 doesn't exist:

curl --user user:password -X GET http://192.168.33.13:10001/api/v1/namespaces/guest/rules/r1
{"error":"The requested resource does not exist.","code":1430}

Creating r1 using PUT:

curl --user user:password -X PUT http://192.168.33.13:10001/api/v1/namespaces/guest/rules/r1 -H "Content-Type: application/json" -d '{"name":"r1","status":"active","trigger":"/guest/trigger1","action":"/guest/action1","publish":false}'
{"name":"r1","publish":false,"annotations":[],"version":"0.0.1","status":"active","action":{"path":"guest/","name":"action1"},"namespace":"guest","trigger":{"path":"guest/","name":"trigger1"}}

Getting r1:

 curl --user user:password -X GET http://192.168.33.13:10001/api/v1/namespaces/guest/rules/r1
{"name":"r1","publish":false,"annotations":[],"version":"0.0.1","status":"active","action":{"path":"guest/","name":"action1"},"namespace":"guest","trigger":{"path":"guest","name":"trigger1"}}

Update rule PUT r1:

curl --user user:password -X PUT http://192.168.33.13:10001/api/v1/namespaces/guest/rules/r1?overwrite=true -H "Content-Type: application/json" -d '{"name":"r1","status":"active","trigger":"/guest/trigger1","action":"/guest/action1","publish":false}'
{"name":"r1","publish":false,"annotations":[],"version":"0.0.2","status":"active","action":{"path":"guest","name":"action1"},"namespace":"guest","trigger":{"path":"guest","name":"trigger1"}}

Get r1:

curl --user user:password -X GET http://192.168.33.13:10001/api/v1/namespaces/guest/rules/r1
{"name":"r1","publish":false,"annotations":[],"version":"0.0.2","status":"inactive","action":{"path":"guest","name":"action1"},"namespace":"guest","trigger":{"path":"guest","name":"trigger1"}}
pritidesai commented 6 years ago

Just tested against IBM Cloud Functions, this issue has been fixed with: https://github.com/apache/incubator-openwhisk/pull/3254