Skip to content
This repository has been archived by the owner on Oct 12, 2023. It is now read-only.

Commit

Permalink
Throw error when deployment fails
Browse files Browse the repository at this point in the history
  • Loading branch information
vivsriaus committed Oct 10, 2016
1 parent d6a58ca commit c1e44e2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/commands/arm/group/group._js
Expand Up @@ -260,7 +260,7 @@ exports.init = function (cli) {
var client = utils.createResourceClient(subscription);
var authzClient = rbacClients.getAuthzClient(subscription);

var progress = cli.interaction.progress($('Listing resource groups'));
var progress = cli.interaction.progress($('Getting resource group'));
var resourceGroup;
try {
resourceGroup = client.resourceGroups.get(name, _);
Expand Down
10 changes: 6 additions & 4 deletions lib/commands/arm/group/group.deployment._js
Expand Up @@ -86,11 +86,9 @@ exports.init = function (cli) {
displayDeploymentStatusMessage(cli, operationsIncludingNested, log, _);

setTimeout(_, 5000);
} while (deployment.properties.provisioningState === 'Running' || deployment.properties.provisioningState === 'Accepted');

if (deployment.properties.provisioningState !== 'Succeeded') {
log.error('Deployment provisioning state was not successful');
} while (utils.ignoreCaseEquals(deployment.properties.provisioningState, 'Running') || utils.ignoreCaseEquals(deployment.properties.provisioningState, 'Accepted'));

if (!utils.ignoreCaseEquals(deployment.properties.provisioningState, 'Succeeded')) {
//display nested template deployment errors, if any exists
var failedOperations = groupUtils.getFailedDeploymentOperations(options.subscription, resourceGroup, deployment.name, _);

Expand All @@ -108,6 +106,7 @@ exports.init = function (cli) {
}
}
});
log.error('');
}
},
_);
Expand All @@ -119,6 +118,9 @@ exports.init = function (cli) {
displayDeployment(data, resourceGroup, true, log);
}
});
if (deployment.properties && utils.ignoreCaseEquals(deployment.properties.provisioningState, 'Failed')) {
throw new Error($('Deployment provisioning state was not successful.'));
}
}
});

Expand Down

0 comments on commit c1e44e2

Please sign in to comment.