Skip to content

Commit 8200e5c

Browse files
committed
flake8 findings
1 parent 0f73249 commit 8200e5c

File tree

6 files changed

+9
-8
lines changed
  • aws_sra_examples/solutions
    • cloudtrail/cloudtrail_org/lambda/src
    • common
      • common_prerequisites/lambda/src
      • common_register_delegated_administrator/lambda/src
    • guardduty/guardduty_org/lambda/src
    • inspector/inspector_org/lambda/src
    • macie/macie_org/lambda/src

6 files changed

+9
-8
lines changed

aws_sra_examples/solutions/cloudtrail/cloudtrail_org/lambda/src/app.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,7 @@ def lambda_handler(event: CloudFormationCustomResourceEvent, context: Context) -
359359
LOGGER.exception(UNEXPECTED)
360360
raise ValueError(f"Unexpected error executing Lambda function. Review CloudWatch logs '{context.log_group_name}' for details.") from None
361361

362+
362363
def terraform_handler(event: CloudFormationCustomResourceEvent, context: Context) -> None:
363364
"""Lambda Handler.
364365
@@ -374,4 +375,4 @@ def terraform_handler(event: CloudFormationCustomResourceEvent, context: Context
374375
process_event(event, context)
375376
except Exception:
376377
LOGGER.exception(UNEXPECTED)
377-
raise ValueError(f"Unexpected error executing Lambda function. Review CloudWatch logs '{context.log_group_name}' for details.") from None
378+
raise ValueError(f"Unexpected error executing Lambda function. Review CloudWatch logs '{context.log_group_name}' for details.") from None

aws_sra_examples/solutions/common/common_prerequisites/lambda/src/app.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,9 @@ def terraform_handler(event: dict, context: Context) -> dict:
505505
506506
Raises:
507507
ValueError: Unexpected error executing Lambda function
508+
509+
Returns:
510+
dict: status code
508511
"""
509512
try:
510513
create_update_event(event, context)
@@ -515,4 +518,4 @@ def terraform_handler(event: dict, context: Context) -> dict:
515518
return response
516519
except Exception as error_msg:
517520
LOGGER.exception(UNEXPECTED)
518-
raise ValueError(f"See the details in CloudWatch Log Stream: '{context.log_group_name}' Error Message: {error_msg}") from None
521+
raise ValueError(f"See the details in CloudWatch Log Stream: '{context.log_group_name}' Error Message: {error_msg}") from None

aws_sra_examples/solutions/common/common_register_delegated_administrator/lambda/src/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,4 +287,4 @@ def terraform_handler(event: dict, context: Context) -> None:
287287
delete(event, context)
288288
except Exception:
289289
LOGGER.exception(UNEXPECTED)
290-
raise ValueError(f"Unexpected error executing Lambda function. Review CloudWatch logs '{context.log_group_name}' for details.") from None
290+
raise ValueError(f"Unexpected error executing Lambda function. Review CloudWatch logs '{context.log_group_name}' for details.") from None

aws_sra_examples/solutions/guardduty/guardduty_org/lambda/src/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,4 +328,4 @@ def terraform_handler(event: Dict[str, Any], context: Context) -> None:
328328
process_cloudformation_event(event, context)
329329
except Exception:
330330
LOGGER.exception(UNEXPECTED)
331-
raise ValueError(f"Unexpected error executing Lambda function. Review CloudWatch logs '{context.log_group_name}' for details.") from None
331+
raise ValueError(f"Unexpected error executing Lambda function. Review CloudWatch logs '{context.log_group_name}' for details.") from None

aws_sra_examples/solutions/inspector/inspector_org/lambda/src/app.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -322,10 +322,8 @@ def disabled_inspector_service(params: dict, regions: list) -> None:
322322
"""
323323
scan_components = params["SCAN_COMPONENTS"].split(",")
324324
LOGGER.info("Remove inspector")
325-
# LOGGER.info(f"disabled_inspector_service: ALL_INSPECTOR_SCAN_COMPONENTS as ({ALL_INSPECTOR_SCAN_COMPONENTS})")
326325
LOGGER.info(f"disabled_inspector_service: scan_components as ({scan_components})")
327326
inspector.disable_inspector_in_associated_member_accounts(
328-
# params["DELEGATED_ADMIN_ACCOUNT_ID"], params["CONFIGURATION_ROLE_NAME"], regions, ALL_INSPECTOR_SCAN_COMPONENTS
329327
params["DELEGATED_ADMIN_ACCOUNT_ID"],
330328
params["CONFIGURATION_ROLE_NAME"],
331329
regions,
@@ -555,7 +553,6 @@ def orchestrator(event: Dict[str, Any], context: Any) -> None:
555553
if event.get("RequestType"):
556554
if event.get("ResourceType") and event["ResourceType"] == "Terraform":
557555
LOGGER.info("...calling process_event from Terraform...")
558-
# process_event_cloudformation(event, context)
559556
process_event(event)
560557
else:
561558
LOGGER.info("...calling helper...")

aws_sra_examples/solutions/macie/macie_org/lambda/src/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,4 +246,4 @@ def terraform_handler(event: Dict[str, Any], context: Context) -> None:
246246
process_cloudformation_event(event, context)
247247
except Exception:
248248
LOGGER.exception(UNEXPECTED)
249-
raise ValueError(f"Unexpected error executing Lambda function. Review CloudWatch logs '{context.log_group_name}' for details.") from None
249+
raise ValueError(f"Unexpected error executing Lambda function. Review CloudWatch logs '{context.log_group_name}' for details.") from None

0 commit comments

Comments
 (0)