|
64 | 64 | # You shouldn't have to modify anything below here. |
65 | 65 | ################################################################################ |
66 | 66 |
|
| 67 | +import botocore |
67 | 68 | import boto3 |
68 | 69 | import os |
69 | 70 | import getopt |
@@ -148,7 +149,6 @@ def delete_alarm(cw, alarmName): |
148 | 149 | cw.delete_alarms(AlarmNames=[alarmName]) |
149 | 150 | else: |
150 | 151 | print(f'Would have deleted alarm {alarmName}.') |
151 | | - return |
152 | 152 |
|
153 | 153 | ################################################################################ |
154 | 154 | # This function checks to see if the alarm already exists. |
@@ -236,13 +236,11 @@ def lambda_handler(event, context): |
236 | 236 |
|
237 | 237 | if len(SNStopic) == 0: |
238 | 238 | raise Exception("You must specify a SNS topic to send the alarm messages to.") |
239 | | - return |
240 | 239 |
|
241 | 240 | if len(accountId) == 0: |
242 | 241 | raise Exception("You must specify an accountId to run this program.") |
243 | | - return |
244 | 242 |
|
245 | | - if len(regions) == 0: |
| 243 | + if len(regions) == 0: # pylint: disable=E0601 |
246 | 244 | ec2Client = boto3.client('ec2') |
247 | 245 | ec2Regions = ec2Client.describe_regions()['Regions'] |
248 | 246 | for region in ec2Regions: |
@@ -382,7 +380,7 @@ def usage(): |
382 | 380 | elif currentArgument in ("-a", "--accountID"): |
383 | 381 | accountId = currentValue |
384 | 382 | elif currentArgument in ("-s", "--SNSTopic"): |
385 | | - snsTopic = currentValue |
| 383 | + SNStopic = currentValue |
386 | 384 | elif currentArgument in ("-C", "--CPUThreshold"): |
387 | 385 | defaultCPUThreshold = int(currentValue) |
388 | 386 | elif currentArgument in ("-S", "--SSDThreshold"): |
|
0 commit comments