From a46339420faefc49cb48adf2989a0884ff961278 Mon Sep 17 00:00:00 2001 From: Alex Shatov Date: Fri, 4 May 2018 12:26:17 -0400 Subject: fixed 500 "value" argument is out of bounds - convert the EOL to linux "\n" in the blueprint before zipping and sending to cloudify to avoid crashing when the blueprint is windows "\r\n" or mac "\r" based - on catching the exception - log the stack - added logger.info that replaced the logger.debug in a variety of places - external version 2.1.2, internal version 4.4.2 - unit test code coverage Statements : 84.26% ( 942/1118 ) Branches : 64.14% ( 322/502 ) Functions : 81.68% ( 156/191 ) Lines : 84.32% ( 930/1103 ) Change-Id: I9f5f28ddd5d143ca4903316c9199df7d27682143 Signed-off-by: Alex Shatov Issue-ID: DCAEGEN2-487 --- lib/deploy.js | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'lib/deploy.js') diff --git a/lib/deploy.js b/lib/deploy.js index dfd73aa..ee31fd3 100644 --- a/lib/deploy.js +++ b/lib/deploy.js @@ -138,27 +138,27 @@ var delay = function(dtime) { // Go through the Cloudify API call sequence to upload blueprint, create deployment, and launch install workflow // (but don't wait for the workflow to finish) const launchBlueprint = function(req, id, blueprint, inputs) { - logger.debug(req.dcaeReqId, "deploymentId: " + id + " starting blueprint upload"); + logger.info(req.dcaeReqId, "deploymentId: " + id + " starting blueprint upload"); // Upload blueprint return cfy.uploadBlueprint(req, id, blueprint) // Create deployment .then (function(result) { - logger.debug(req.dcaeReqId, "deploymentId: " + id + " blueprint uploaded"); + logger.info(req.dcaeReqId, "deploymentId: " + id + " blueprint uploaded"); // Create deployment return cfy.createDeployment(req, id, id, inputs); }) // Launch the workflow, but don't wait for it to complete .then(function(result){ - logger.debug(req.dcaeReqId, "deploymentId: " + id + " deployment created"); + logger.info(req.dcaeReqId, "deploymentId: " + id + " deployment created"); return delay(DELAY_INSTALL_WORKFLOW) .then(function(){ return cfy.initiateWorkflowExecution(req, id, 'install'); }); }) .catch(function(error) { - logger.debug(req.dcaeReqId, "Error: " + error + " for launch blueprint for deploymentId " + id); + logger.info(req.dcaeReqId, "Error: " + JSON.stringify(error) + " for launch blueprint for deploymentId " + id); throw normalizeError(error); }); }; @@ -166,10 +166,10 @@ exports.launchBlueprint = launchBlueprint; // Finish installation launched with launchBlueprint const finishInstallation = function(req, deploymentId, executionId) { - logger.debug(req.dcaeReqId, "finishInstallation: " + deploymentId + " -- executionId: " + executionId); + logger.info(req.dcaeReqId, "finishInstallation: " + deploymentId + " -- executionId: " + executionId); return cfy.getWorkflowResult(req, executionId) .then (function(result){ - logger.debug(req.dcaeReqId, "deploymentId: " + deploymentId + " install workflow successfully executed"); + logger.info(req.dcaeReqId, "deploymentId: " + deploymentId + " install workflow successfully executed"); // Retrieve the outputs from the deployment, as specified in the blueprint return delay(DELAY_RETRIEVE_OUTPUTS).then(function() { return cfy.getOutputs(req, deploymentId); @@ -186,11 +186,11 @@ const finishInstallation = function(req, deploymentId, executionId) { } } } - logger.debug(req.dcaeReqId, "output retrieval result for " + deploymentId + ": " + JSON.stringify(result)); + logger.info(req.dcaeReqId, "output retrieval result for " + deploymentId + ": " + JSON.stringify(result)); return annotateOutputs(req, deploymentId, rawOutputs); }) .catch(function(err) { - logger.debug(req.dcaeReqId, "Error finishing install workflow: " + err + " -- " + JSON.stringify(err)); + logger.info(req.dcaeReqId, "Error finishing install workflow: " + err + " -- " + JSON.stringify(err)); throw normalizeError(err); }); }; @@ -198,31 +198,31 @@ exports.finishInstallation = finishInstallation; // Initiate uninstall workflow against a deployment, but don't wait for workflow to finish const launchUninstall = function(req, deploymentId) { - logger.debug(req.dcaeReqId, "deploymentId: " + deploymentId + " starting uninstall workflow"); + logger.info(req.dcaeReqId, "deploymentId: " + deploymentId + " starting uninstall workflow"); // Run uninstall workflow return cfy.initiateWorkflowExecution(req, deploymentId, 'uninstall') .then(function(result) { return result; }) .catch(function(err) { - logger.debug(req.dcaeReqId, "Error initiating uninstall workflow: " + err + " -- " + JSON.stringify(err)); + logger.info(req.dcaeReqId, "Error initiating uninstall workflow: " + err + " -- " + JSON.stringify(err)); throw normalizeError(err); }); }; exports.launchUninstall = launchUninstall; const finishUninstall = function(req, deploymentId, executionId) { - logger.debug(req.dcaeReqId, "finishUninstall: " + deploymentId + " -- executionId: " + executionId); + logger.info(req.dcaeReqId, "finishUninstall: " + deploymentId + " -- executionId: " + executionId); return cfy.getWorkflowResult(req, executionId) .then (function(result){ - logger.debug(req.dcaeReqId, "deploymentId: " + deploymentId + " uninstall workflow successfully executed"); + logger.info(req.dcaeReqId, "deploymentId: " + deploymentId + " uninstall workflow successfully executed"); // Delete the deployment return delay(DELAY_DELETE_DEPLOYMENT).then(function() { return cfy.deleteDeployment(req, deploymentId); }); }) .then (function(result){ - logger.debug(req.dcaeReqId, "deploymentId: " + deploymentId + " deployment deleted"); + logger.info(req.dcaeReqId, "deploymentId: " + deploymentId + " deployment deleted"); // Delete the blueprint return delay(DELAY_DELETE_BLUEPRINT).then(function() { return cfy.deleteBlueprint(req, deploymentId); @@ -264,7 +264,7 @@ exports.getExecutionStatus = function (req, exid) { if (res.json.error) { result.error = res.json.error; } - logger.debug(req.dcaeReqId, "getExecutionStatus result: " + JSON.stringify(result)); + logger.info(req.dcaeReqId, "getExecutionStatus result: " + JSON.stringify(result)); return result; }) .catch(function(error) { @@ -294,7 +294,7 @@ exports.deployBlueprint = function(req, id, blueprint, inputs) { // Go through the Cloudify API call sequence to do an undeployment of a previously deployed blueprint exports.undeployDeployment = function(req, id) { - logger.debug(req.dcaeReqId, "deploymentId: " + id + " starting uninstall workflow"); + logger.info(req.dcaeReqId, "deploymentId: " + id + " starting uninstall workflow"); // Run launch uninstall workflow return launchUninstall(req, id) -- cgit 1.2.3-korg