Skip to content

Commit 624c0cc

Browse files
author
AWS
committed
Release: 1.9.1
1 parent 5b302a6 commit 624c0cc

File tree

3 files changed

+33
-22
lines changed

3 files changed

+33
-22
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.9.0
1+
1.9.1

sources/aft-lambda-layer/aft_common/codepipeline.py

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -102,30 +102,31 @@ def list_pipelines(session: Session) -> List[Any]:
102102
return matched_pipelines
103103

104104

105-
def get_running_pipeline_count(session: Session, names: List[str]) -> int:
105+
def get_running_pipeline_count(session: Session, pipeline_names: List[str]) -> int:
106106
pipeline_counter = 0
107107
client = session.client("codepipeline")
108108

109-
for p in names:
110-
logger.info("Getting pipeline executions for " + p)
111-
112-
response = client.list_pipeline_executions(pipelineName=p)
113-
pipeline_execution_summaries = response["pipelineExecutionSummaries"]
114-
115-
while "nextToken" in response:
116-
response = client.list_pipeline_executions(
117-
pipelineName=p, nextToken=response["nextToken"]
118-
)
119-
pipeline_execution_summaries.extend(response["pipelineExecutionSummaries"])
120-
121-
latest_execution = sorted(
122-
pipeline_execution_summaries, key=lambda i: i["startTime"], reverse=True # type: ignore
123-
)[0]
124-
logger.info("Latest Execution: ")
125-
logger.info(latest_execution)
126-
127-
if latest_execution["status"] == "InProgress":
128-
pipeline_counter += 1
109+
for name in pipeline_names:
110+
logger.info("Getting pipeline executions for " + name)
111+
pipeline_execution_summaries = []
112+
113+
paginator = client.get_paginator("list_pipeline_executions")
114+
pages = paginator.paginate(pipelineName=name)
115+
for page in pages:
116+
pipeline_execution_summaries.extend(page["pipelineExecutionSummaries"])
117+
118+
if not pipeline_execution_summaries:
119+
# No executions for this pipeline in the last 12 months
120+
continue
121+
else:
122+
latest_execution = sorted(
123+
pipeline_execution_summaries, key=lambda i: i["startTime"], reverse=True # type: ignore
124+
)[0]
125+
logger.info("Latest Execution: ")
126+
logger.info(latest_execution)
127+
128+
if latest_execution["status"] == "InProgress":
129+
pipeline_counter += 1
129130

130131
logger.info("The number of running pipelines is " + str(pipeline_counter))
131132

src/aft_lambda/aft_account_request_framework/aft_account_request_action_trigger.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,16 @@ def lambda_handler(event: Dict[str, Any], context: LambdaContext) -> None:
5252
logger.info("New account request received")
5353
record_handler.handle_account_request(new_account=True)
5454

55+
# In this situation, a new entry has been added to the account request table
56+
# and a provisioned product exists, and No Control Tower parameters changed
57+
elif (
58+
record_handler.is_create_action
59+
and provisioned_product_exists(record=record_handler.record)
60+
and not record_handler.control_tower_parameters_updated
61+
):
62+
logger.info("Customization request received for existing CT account")
63+
record_handler.handle_customization_request()
64+
5565
# If we're processing a request that updates an existing entry in the
5666
# account request table, we need to handle control tower parameter changes
5767
# by routing the request to service catalog

0 commit comments

Comments
 (0)