rabbah commented on a change in pull request #2613: Patch posting of trigger 
activation.
URL: 
https://github.com/apache/incubator-openwhisk/pull/2613#discussion_r132906034
 
 

 ##########
 File path: core/controller/src/main/scala/whisk/core/controller/Triggers.scala
 ##########
 @@ -173,20 +171,25 @@ trait WhiskTriggersApi extends WhiskCollectionAPI {
                                             Path.SingleSlash + 
rule.action.name.asString
                                         }
                                     }.toString
+
                                     val actionUrl = Path("/api/v1") / 
"namespaces" / actionNamespace / "actions"
                                     val request = HttpRequest(
                                         method = POST,
                                         uri = url.withPath(actionUrl + 
actionPath),
                                         headers = 
List(Authorization(BasicHttpCredentials(user.authkey.uuid.asString, 
user.authkey.key.asString))),
                                         entity = 
HttpEntity(MediaTypes.`application/json`, 
args.getOrElse(JsObject()).compactPrint))
 
-                                    Http().singleRequest(request).map {
-                                        case HttpResponse(StatusCodes.OK, 
headers, entity, _) =>
-                                            logging.info(this, s"successfully 
invoked ${rule.action} -> ")
-                                        case 
HttpResponse(StatusCodes.NotFound, _, _, _) =>
-                                            logging.info(this, s"action 
${rule.action} could not be found")
-                                        case HttpResponse(code, _, entity, _) 
=>
-                                            logging.warn(this, s"action 
${rule.action} could not be invoked due to ${entity.getDataBytes.toString}")
+                                    Http().singleRequest(request).map { 
response =>
+                                        response.status match {
+                                            case OK | Accepted => 
Unmarshal(response.entity).to[JsObject].map { a =>
+                                                logging.info(this, 
s"${rule.action} activated ${a.fields("activationId")}")
+                                            }
+                                            case NotFound =>
+                                                logging.info(this, 
s"${rule.action} failed, action not found")
 
 Review comment:
   Or response.discardEntityBytes()?
   
   Thx for the catch. 
 
----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to