aws-architect 6.6.26 → 6.6.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -54,35 +54,46 @@ class CloudFormationDeployer {
54
54
  }
55
55
  }
56
56
 
57
- stackExists(stackName) {
58
- return this.cloudFormationClient.describeStacks({ StackName: stackName }).promise()
59
- .then(async data => {
60
- if (!data.Stacks[0]) {
61
- return false;
62
- }
63
- let stackStatus = data.Stacks[0].StackStatus;
64
- let stackExistsDict = {
65
- CREATE_COMPLETE: true,
66
- UPDATE_COMPLETE: true,
67
- UPDATE_ROLLBACK_COMPLETE: true
68
- };
57
+ async stackExists(stackName) {
58
+ let data;
59
+ try {
60
+ data = await this.cloudFormationClient.describeStacks({ StackName: stackName }).promise();
61
+ } catch (error) {
62
+ return false;
63
+ }
64
+ if (!data.Stacks[0]) {
65
+ return false;
66
+ }
67
+ let stackStatus = data.Stacks[0].StackStatus;
68
+ let stackExistsDict = {
69
+ CREATE_COMPLETE: true,
70
+ UPDATE_COMPLETE: true,
71
+ UPDATE_ROLLBACK_COMPLETE: true
72
+ };
69
73
 
70
- if (stackExistsDict[stackStatus]) {
71
- return true;
72
- }
73
- if (stackStatus === 'REVIEW_IN_PROGRESS') {
74
- return false;
75
- }
76
- if (stackStatus === 'ROLLBACK_COMPLETE') {
77
- console.log('Current status of stack is ROLLBACK_COMPLETE, deleting before generating a new stack.');
78
- await this.cloudFormationClient.deleteStack({ StackName: stackName }).promise();
79
- return false;
74
+ if (stackExistsDict[stackStatus]) {
75
+ return true;
76
+ }
77
+ if (stackStatus === 'REVIEW_IN_PROGRESS') {
78
+ return false;
79
+ }
80
+ if (stackStatus === 'ROLLBACK_COMPLETE') {
81
+ console.log('Current status of stack is ROLLBACK_COMPLETE, deleting before generating a new stack.');
82
+ await this.cloudFormationClient.deleteStack({ StackName: stackName }).promise();
83
+ for (let checkIteration = 0; checkIteration < 120; checkIteration++) {
84
+ try {
85
+ await this.cloudFormationClient.describeStacks({ StackName: stackName }).promise();
86
+ await new Promise(resolve => setTimeout(resolve, 5000));
87
+ } catch (error) {
88
+ break;
89
+ }
80
90
  }
81
- throw { error: 'Current status of stack prevents creation or update.', status: stackStatus };
82
- }, () => false);
91
+ return false;
92
+ }
93
+ throw { error: 'Current status of stack prevents creation or update.', status: stackStatus };
83
94
  }
84
95
 
85
- async waitForCompletion(stackName, allow_update_rollback) {
96
+ async waitForCompletion(stackName, allowUpdateRollback) {
86
97
  let timeout = new Date();
87
98
  let timeoutLength = 60 * 60 * 1000;
88
99
  timeout.setTime(timeout.getTime() + timeoutLength);
@@ -110,7 +121,7 @@ class CloudFormationDeployer {
110
121
  throw { error: 'Current status of the stack has failed', status: stackStatus };
111
122
  }
112
123
 
113
- if (!allow_update_rollback && stackStatus === 'UPDATE_ROLLBACK_COMPLETE') {
124
+ if (!allowUpdateRollback && stackStatus === 'UPDATE_ROLLBACK_COMPLETE') {
114
125
  throw { title: 'Current stack status is failure', status: stackStatus };
115
126
  }
116
127
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aws-architect",
3
- "version": "6.6.26",
3
+ "version": "6.6.28",
4
4
  "description": "AWS Architect is a node based tool to configure and deploy AWS-based microservices.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",