openwhisk-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From csantan...@apache.org
Subject [incubator-openwhisk-package-alarms] branch master updated: update Node.js to version 10 (#171)
Date Wed, 12 Dec 2018 18:35:43 GMT
This is an automated email from the ASF dual-hosted git repository.

csantanapr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-package-alarms.git


The following commit(s) were added to refs/heads/master by this push:
     new 9b4102e  update Node.js to version 10 (#171)
9b4102e is described below

commit 9b4102e7ae1c9413487ca232425c089fd9efff2c
Author: Jason Peterson <jasonpet@us.ibm.com>
AuthorDate: Wed Dec 12 13:35:39 2018 -0500

    update Node.js to version 10 (#171)
---
 Dockerfile                  |  2 +-
 provider/lib/authHandler.js |  8 ++++----
 provider/lib/utils.js       | 15 ++++-----------
 3 files changed, 9 insertions(+), 16 deletions(-)

diff --git a/Dockerfile b/Dockerfile
index 9699608..51525bc 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,4 @@
-FROM node:8.14.0
+FROM node:10.14.0
 
 # only package.json
 ADD package.json /
diff --git a/provider/lib/authHandler.js b/provider/lib/authHandler.js
index 8ec79a9..902c9d9 100644
--- a/provider/lib/authHandler.js
+++ b/provider/lib/authHandler.js
@@ -1,14 +1,14 @@
 // Licensed to the Apache Software Foundation (ASF) under one or more contributor
 // license agreements; and to You under the Apache License, Version 2.0.
 
-function handleAuth(triggerData) {
+function handleAuth(triggerData, options) {
 
     var auth = triggerData.apikey.split(':');
-    return Promise.resolve({
+    options.auth = {
         user: auth[0],
         pass: auth[1]
-    });
-
+    };
+    return Promise.resolve(options);
 }
 
 module.exports = {
diff --git a/provider/lib/utils.js b/provider/lib/utils.js
index d70881b..6dde7ef 100644
--- a/provider/lib/utils.js
+++ b/provider/lib/utils.js
@@ -100,13 +100,7 @@ module.exports = function(logger, triggerDB, redisClient) {
                 json: triggerData.payload
             }, function(error, response) {
                 try {
-                    var statusCode;
-                    if (!error) {
-                        statusCode = response.statusCode;
-                    }
-                    else if (error.statusCode) {
-                        statusCode = error.statusCode;
-                    }
+                    var statusCode = !error ? response.statusCode : error.statusCode;
                     var triggerIdentifier = triggerData.triggerID;
                     logger.info(method, triggerIdentifier, 'http post request, STATUS:',
statusCode);
 
@@ -508,10 +502,9 @@ module.exports = function(logger, triggerDB, redisClient) {
     this.authRequest = function(triggerData, options, cb) {
         var method = 'authRequest';
 
-        authHandler.handleAuth(triggerData)
-        .then(auth => {
-            options.auth = auth;
-            request(options, cb);
+        authHandler.handleAuth(triggerData, options)
+        .then(requestOptions => {
+            request(requestOptions, cb);
         })
         .catch(err => {
             logger.error(method, err);


Mime
View raw message