diff options
author | Shadi Haidar <sh1986@att.com> | 2018-09-07 22:05:43 -0400 |
---|---|---|
committer | Shadi Haidar <sh1986@att.com> | 2018-09-12 13:58:04 -0400 |
commit | ceda84d021dde70299f96984ca7aec16740854be (patch) | |
tree | 967b1c37a9e21721240d68e9b81dc59a0a593512 /lib/deploy.js | |
parent | 8ca8ddf40decb543e5ea634e29efe6972272a2f6 (diff) |
Check deployment creation before install
Unit Test Code Coverage:
Statements : 76.85% ( 893/1162 )
Branches : 52.99% ( 275/519 )
Functions : 78.68% ( 155/197 )
Lines : 77.21% ( 884/1145 )
Issue-ID: DCAEGEN2-754
Change-Id: Id8f3fa26e8ece7e9099145ea20034829a1ad7d13
Signed-off-by: Shadi Haidar <sh1986@att.com>
Diffstat (limited to 'lib/deploy.js')
-rw-r--r-- | lib/deploy.js | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/lib/deploy.js b/lib/deploy.js index ee31fd3..2d75b52 100644 --- a/lib/deploy.js +++ b/lib/deploy.js @@ -144,23 +144,23 @@ const launchBlueprint = function(req, id, blueprint, inputs) { // Create deployment .then (function(result) { - logger.info(req.dcaeReqId, "deploymentId: " + id + " blueprint uploaded"); - // Create deployment - return cfy.createDeployment(req, id, id, inputs); + 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 + // create the deployment and keep checking, for up to 5 minutes, until creation is complete .then(function(result){ - 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.info(req.dcaeReqId, "Error: " + JSON.stringify(error) + " for launch blueprint for deploymentId " + id); - throw normalizeError(error); - }); + return cfy.getDeploymentCreationResult(req, id); + }) + .then(function(){ + logger.info(req.dcaeReqId, "deploymentId: " + id + " deployment created"); + return cfy.initiateWorkflowExecution(req, id, 'install'); + }) + .catch(function(error) { + logger.info(req.dcaeReqId, "Error: " + JSON.stringify(error) + " for launch blueprint/deployment creation for deploymentId " + id); + throw normalizeError(error); + }); }; exports.launchBlueprint = launchBlueprint; |