Check if conditions in more pythonic ways

This commit is contained in:
skyuecx0630 2024-08-12 19:50:36 +09:00
parent eae572c5ba
commit 858aab4eac

View File

@ -15,7 +15,7 @@ def codebuild_project_environment_privileged_check():
for project in projects: for project in projects:
project = build_client.batch_get_projects(names=[project])["projects"][0] project = build_client.batch_get_projects(names=[project])["projects"][0]
if project["environment"]["privilegedMode"] != True: if not project["environment"]["privilegedMode"]:
compliant_resources.append(project["arn"]) compliant_resources.append(project["arn"])
else: else:
non_compliant_resources.append(project["arn"]) non_compliant_resources.append(project["arn"])
@ -61,8 +61,8 @@ def codedeploy_auto_rollback_monitor_enabled():
)["deploymentGroupInfo"] )["deploymentGroupInfo"]
if ( if (
deployment_group["alarmConfiguration"]["enabled"] == True deployment_group["alarmConfiguration"]["enabled"]
and deployment_group["autoRollbackConfiguration"]["enabled"] == True and deployment_group["autoRollbackConfiguration"]["enabled"]
): ):
compliant_resources.append(deployment_group["deploymentGroupId"]) compliant_resources.append(deployment_group["deploymentGroupId"])
else: else: