diff options
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; |