aboutsummaryrefslogtreecommitdiffstats
path: root/lib/inventory.js
diff options
context:
space:
mode:
authorShadi Haidar <sh1986@att.com>2019-02-15 17:38:41 -0500
committerShadi Haidar <sh1986@att.com>2019-03-26 08:56:33 -0400
commit7c78f9c1208af746b417c5184abfaddc318926b4 (patch)
tree6c0ad6cb18859c6233020a12fced0ccb96d29117 /lib/inventory.js
parent12c8d505c49b8b999660c52872a66071a9abc4c6 (diff)
Add health and service endpoints
4.0.0 deployment-handler Upgraded cloudify api from 2.1 to 3.1 due to new cloudify /status api Requires upgrading Cloudify to 4.x Added 2 APIs to check health of DH itself and to Inventory and Cloudify Coverage summary Statements : 80.75% ( 994/1231 ) Branches : 57.74% ( 302/523 ) Functions : 81.13% ( 172/212 ) Lines : 81.26% ( 984/1211 ) Issue-ID: DCAEGEN2-1127 Change-Id: Ic851a576eed668016f6cfe956f0f1880a65e1065 Signed-off-by: Shadi Haidar <sh1986@att.com>
Diffstat (limited to 'lib/inventory.js')
-rw-r--r--lib/inventory.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/inventory.js b/lib/inventory.js
index 5935067..0d06856 100644
--- a/lib/inventory.js
+++ b/lib/inventory.js
@@ -24,6 +24,7 @@ const createError = require('./dispatcher-error').createDispatcherError;
const INV_SERV_TYPES = '/dcae-service-types';
const INV_SERVICES = '/dcae-services';
+const INV_SERVICE_HEALTH = '/servicehealth';
/*
* Common error handling for inventory API calls
@@ -162,6 +163,29 @@ module.exports = function(options) {
return invError(err);
}
});
+ },
+
+ /*
+ * Check if inventory service is healthy using inventory's service check api
+ */
+
+ isServiceHealthy: function(req) {
+ return doRequest(req, {
+ method: "GET",
+ uri: url + INV_SERVICE_HEALTH
+ }, null, INVENTORY)
+
+ .then(function(res) {
+ if ( res.status == 200 ) {
+ return true;
+ }
+ else {
+ return false;
+ }
+ },
+ function (err) {
+ return invError(err);
+ });
}
};
};