You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by gi...@git.apache.org on 2017/10/03 00:06:48 UTC

[GitHub] pritidesai commented on a change in pull request #578: Trigger feed Update and Locking Creation/Deletion of OpenWhisk entities

pritidesai commented on a change in pull request #578: Trigger feed Update and Locking Creation/Deletion of OpenWhisk entities
URL: https://github.com/apache/incubator-openwhisk-wskdeploy/pull/578#discussion_r142286364
 
 

 ##########
 File path: deployers/servicedeployer.go
 ##########
 @@ -527,6 +535,19 @@ func (deployer *ServiceDeployer) createFeedAction(trigger *whisk.Trigger, feedNa
 		Publish:     &pub,
 	}
 
+	// triggers created using any of the feeds including cloudant, alarm, message hub etc
+	// does not honor UPDATE or overwrite=true with CREATE
+	// wskdeploy is designed such that, it updates trigger feeds if they exists
+	// or creates new in case they are missing
+	// To address trigger feed UPDATE issue, we are checking here if trigger feed
+	// exists, if so, delete it and recreate it
+	_, r, _ := deployer.Client.Triggers.Get(trigger.Name)
+	if r.StatusCode == 200 {
 
 Review comment:
   Yup, the issue here is, when an HTTP request is sent with `overwrite=true` it fails with:
   
   ```
   REQUEST:
   [PUT]   https://openwhisk.ng.bluemix.net/api/v1/namespaces/<namespace>/triggers/periodic?overwrite=false
   Req Headers
   {
     "Authorization": [
       "<auth>"
     ],
     "Content-Type": [
       "application/json"
     ]
   }
   Req Body
   {{"name":"periodic","annotations":[{"key":"feed","value":"/whisk.system/alarms/alarm"}]}
   }
   ```
   
   Response:
   
   ```
   {
       "error": "A trigger feed is only permitted when the trigger is created",
       "code": 31983192
   }
   ```
   
   So in case when a trigger is associated with any of the feeds, we have two options either (1) we skip the update and return success if it exists (2) delete and recreate if it exists 
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services