Cleanup code readability of base stack
parent
d608318778
commit
f7b7752040
|
|
@ -851,14 +851,17 @@ class AWSBaseStack {
|
||||||
Parameters: parameters,
|
Parameters: parameters,
|
||||||
Capabilities: ['CAPABILITY_IAM'],
|
Capabilities: ['CAPABILITY_IAM'],
|
||||||
};
|
};
|
||||||
const stacks = (_a = (yield CF.listStacks({ StackStatusFilter: ['UPDATE_COMPLETE', 'CREATE_COMPLETE', 'ROLLBACK_COMPLETE'] }).promise()).StackSummaries) === null || _a === void 0 ? void 0 : _a.map((x) => x.StackName);
|
const stacks = yield CF.listStacks({
|
||||||
const stackExists = (stacks === null || stacks === void 0 ? void 0 : stacks.includes(baseStackName)) || false;
|
StackStatusFilter: ['UPDATE_COMPLETE', 'CREATE_COMPLETE', 'ROLLBACK_COMPLETE'],
|
||||||
|
}).promise();
|
||||||
|
const stackNames = ((_a = stacks.StackSummaries) === null || _a === void 0 ? void 0 : _a.map((x) => x.StackName)) || [];
|
||||||
|
const stackExists = stackNames.includes(baseStackName) || false;
|
||||||
const describeStack = () => __awaiter(this, void 0, void 0, function* () {
|
const describeStack = () => __awaiter(this, void 0, void 0, function* () {
|
||||||
return yield CF.describeStacks(describeStackInput).promise();
|
return yield CF.describeStacks(describeStackInput).promise();
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
if (!stackExists) {
|
if (!stackExists) {
|
||||||
cloud_runner_logger_1.default.log(`${baseStackName} stack does not exist (${JSON.stringify(stacks)})`);
|
cloud_runner_logger_1.default.log(`${baseStackName} stack does not exist (${JSON.stringify(stackNames)})`);
|
||||||
yield CF.createStack(createStackInput).promise();
|
yield CF.createStack(createStackInput).promise();
|
||||||
cloud_runner_logger_1.default.log(`created stack (version: ${parametersHash})`);
|
cloud_runner_logger_1.default.log(`created stack (version: ${parametersHash})`);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -44,16 +44,17 @@ export class AWSBaseStack {
|
||||||
Capabilities: ['CAPABILITY_IAM'],
|
Capabilities: ['CAPABILITY_IAM'],
|
||||||
};
|
};
|
||||||
|
|
||||||
const stacks = (
|
const stacks = await CF.listStacks({
|
||||||
await CF.listStacks({ StackStatusFilter: ['UPDATE_COMPLETE', 'CREATE_COMPLETE', 'ROLLBACK_COMPLETE'] }).promise()
|
StackStatusFilter: ['UPDATE_COMPLETE', 'CREATE_COMPLETE', 'ROLLBACK_COMPLETE'],
|
||||||
).StackSummaries?.map((x) => x.StackName);
|
}).promise();
|
||||||
const stackExists: Boolean = stacks?.includes(baseStackName) || false;
|
const stackNames = stacks.StackSummaries?.map((x) => x.StackName) || [];
|
||||||
|
const stackExists: Boolean = stackNames.includes(baseStackName) || false;
|
||||||
const describeStack = async () => {
|
const describeStack = async () => {
|
||||||
return await CF.describeStacks(describeStackInput).promise();
|
return await CF.describeStacks(describeStackInput).promise();
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
if (!stackExists) {
|
if (!stackExists) {
|
||||||
CloudRunnerLogger.log(`${baseStackName} stack does not exist (${JSON.stringify(stacks)})`);
|
CloudRunnerLogger.log(`${baseStackName} stack does not exist (${JSON.stringify(stackNames)})`);
|
||||||
await CF.createStack(createStackInput).promise();
|
await CF.createStack(createStackInput).promise();
|
||||||
CloudRunnerLogger.log(`created stack (version: ${parametersHash})`);
|
CloudRunnerLogger.log(`created stack (version: ${parametersHash})`);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue