aws-cfm-utils
Advanced tools
Comparing version 1.6.1 to 1.6.2
@@ -6,29 +6,24 @@ 'use strict'; | ||
const { describeAutoScallingGroup } = require('./describe_autoscalling_group.js'); | ||
const sleep = require('util').promisify(setTimeout); | ||
try { | ||
const autoScalingGroups = await getAutoScalingGroups(cfm, stackname); | ||
const autoScalingGroups = await getAutoScalingGroups(cfm, stackname); | ||
autoScalingGroups.forEach(async (group) => { | ||
let asgStatus; | ||
autoScalingGroups.forEach(async (group) => { | ||
let asgStatus; | ||
try { | ||
asgStatus = await describeAutoScallingGroup(asg, group); | ||
while (asgStatus[0].ProcessName === 'ScheduledActions') { | ||
console.log('Resuming ASG ScheduledActions in: ' + group); | ||
await asg.resumeProcesses({ | ||
AutoScalingGroupName: group, ScalingProcesses: ['ScheduledActions'] | ||
}).promise(); | ||
asgStatus = await describeAutoScallingGroup(asg, group); | ||
asgStatus = await describeAutoScallingGroup(asg, group); | ||
} | ||
} | ||
catch (err) { | ||
return err.stack; | ||
} | ||
}); | ||
} | ||
catch (err) { | ||
return err.stack; | ||
} | ||
await asg.resumeProcesses({ | ||
AutoScalingGroupName: group, ScalingProcesses: ['ScheduledActions'] | ||
}).promise(); | ||
await sleep(1000); | ||
asgStatus = await describeAutoScallingGroup(asg, group); | ||
if (asgStatus == undefined || asgStatus === '' || asgStatus.length === 0) { | ||
console.log('Resumed ASG ScheduledActions in: ' + group); | ||
} | ||
}); | ||
await sleep(10000); | ||
}; | ||
@@ -35,0 +30,0 @@ |
@@ -10,4 +10,2 @@ 'use strict'; | ||
await sleep(10000); | ||
try { | ||
@@ -45,11 +43,6 @@ const autoScalingGroups = await getAutoScalingGroups(cfm, stackname); | ||
console.log('Suspended ASG ScheduledActions in: ' + group); | ||
return true; | ||
} | ||
else { | ||
return false; | ||
} | ||
} | ||
catch (err) { | ||
return err.stack; | ||
console.error(err); | ||
} | ||
@@ -59,3 +52,3 @@ }); | ||
catch (err) { | ||
return err.stack; | ||
console.error(err); | ||
} | ||
@@ -62,0 +55,0 @@ }; |
@@ -56,8 +56,4 @@ 'use strict'; | ||
try { | ||
await suspendScheduledActions(asg, cfm, args.stackName); | ||
} | ||
catch (err) { | ||
console.error(err); | ||
} | ||
console.log('Suspending ASG actions...'); | ||
await suspendScheduledActions(asg, cfm, args.stackName); | ||
@@ -70,5 +66,7 @@ try { | ||
console.log('Update not required. No changes to the cfm stack! ' + err + '\n'); | ||
await resumeScheduledActions(asg, cfm, args.stackName); | ||
process.exit(0); | ||
} | ||
console.error('Exiting with error type: ' + err.stack); | ||
await resumeScheduledActions(asg, cfm, args.stackName); | ||
process.exit(2); | ||
@@ -92,2 +90,3 @@ } | ||
console.log('Aborting - Timeout while updating'); | ||
await resumeScheduledActions(asg, cfm, args.stackName); | ||
process.exit(1); | ||
@@ -108,11 +107,8 @@ } | ||
console.log('Failure - Stack update unsuccessful'); | ||
await resumeScheduledActions(asg, cfm, args.stackName); | ||
process.exit(1); | ||
} | ||
try { | ||
await resumeScheduledActions(asg, cfm, args.stackName); | ||
} | ||
catch (err) { | ||
console.error(err); | ||
} | ||
console.log('Resuming ASG actions...'); | ||
await resumeScheduledActions(asg, cfm, args.stackName); | ||
@@ -119,0 +115,0 @@ console.log('Success - Stack Updated successfully! \n'); |
@@ -22,3 +22,3 @@ 'use strict'; | ||
catch (err) { | ||
return err.stack; | ||
console.error(err); | ||
} | ||
@@ -25,0 +25,0 @@ }; |
{ | ||
"name": "aws-cfm-utils", | ||
"version": "1.6.1", | ||
"version": "1.6.2", | ||
"description": "AWS utils to deploy cloudformation stack/templates", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
95274
2199