@@ -81,7 +81,7 @@ Resources:
8181 Properties :
8282 Description : " Event rule to trigger the FSxN Report Lambda function."
8383 Name : !Sub "FSxN_Report-${AWS::StackName}"
84- ScheduleExpression : " cron(0 0 * * ? *)" # Every day at midnight UTC
84+ ScheduleExpression : " cron(0 0 * * ? *)"
8585 State : " ENABLED"
8686 Targets :
8787 - Arn : !GetAtt LambdaFunction.Arn
@@ -93,7 +93,7 @@ Resources:
9393 Properties :
9494 Description : " Event rule to trigger the FSxN Report Lambda function."
9595 Name : !Sub "FSxN_Report-${AWS::StackName}"
96- ScheduleExpression : " cron(0 0 ? * 2 *)" # Every Monday at midnight UTC
96+ ScheduleExpression : " cron(0 0 ? * 2 *)"
9797 State : " ENABLED"
9898 Targets :
9999 - Arn : !GetAtt LambdaFunction.Arn
@@ -105,7 +105,7 @@ Resources:
105105 Properties :
106106 Description : " Event rule to trigger the FSxN Report Lambda function."
107107 Name : !Sub "FSxN_Report-${AWS::StackName}"
108- ScheduleExpression : " cron(0 0 1 * ? *)" # Every month on the first day at midnight UTC
108+ ScheduleExpression : " cron(0 0 1 * ? *)"
109109 State : " ENABLED"
110110 Targets :
111111 - Arn : !GetAtt LambdaFunction.Arn
@@ -183,7 +183,7 @@ Resources:
183183 PackageType : " Zip"
184184 Runtime : " python3.13"
185185 Handler : " index.lambda_handler"
186- Timeout : 300 # 5 minutes
186+ Timeout : 300
187187 Environment :
188188 Variables :
189189 TO_ADDRESS : !Ref emailTo
@@ -220,9 +220,7 @@ Resources:
220220
221221 import boto3
222222 from botocore.config import Config
223- import json
224223 from datetime import datetime, timedelta
225- import argparse
226224 import os
227225
228226 ################################################################################
@@ -255,13 +253,13 @@ Resources:
255253 for fsxn in fsxnData['FileSystems']:
256254 if fsxn['FileSystemType'] == 'ONTAP':
257255 fsxns.append(fsxn)
258- next = fsxnData.get('NextToken')
259- while next :
256+ nextToken = fsxnData.get('NextToken')
257+ while nextToken :
260258 fsxnData = fsxClient.describe_file_systems(NextToken=next)
261259 for fsxn in fsxnData['FileSystems']:
262260 if fsxn['FileSystemType'] == 'ONTAP':
263261 fsxns.append(fsxn)
264- next = fsxnData.get('NextToken')
262+ nextToken = fsxnData.get('NextToken')
265263 #
266264 # Retrieve all the FSxN usage information
267265 fsxnUsageInfo = {}
@@ -556,7 +554,7 @@ Resources:
556554 def emailReport(report, fromAddress, toAddress):
557555
558556 sesClient = boto3.client('ses')
559- response = sesClient.send_email(
557+ sesClient.send_email(
560558 Destination={
561559 'ToAddresses': [
562560 toAddress
@@ -678,7 +676,7 @@ Resources:
678676 raise Exception(f"Report for region {region} exceeds maximum email size of {maxEmailSize} characters.")
679677
680678 if len(report) + len(currentReport) > maxEmailSize:
681- emailReport(report, fromAddress, toAddress )
679+ emailReport(report, config['FROM_ADDRESS'], config['TO_ADDRESS'] )
682680 report = currentReport
683681 currentReport = ""
684682 else:
0 commit comments