in taskcat/_cfn/threaded.py [0:0]
def _get_taskcat_stacks(region, boto_cache: Boto3Cache, profile: str):
stacks = []
try:
cfn = boto_cache.client("cloudformation", profile=profile, region=region)
for page in cfn.get_paginator("describe_stacks").paginate():
for stack_props in page["Stacks"]:
if stack_props.get("ParentId"):
continue
stack_id = stack_props["StackId"]
stack_name = stack_id.split("/")[1]
stack = {
"region": region,
"profile": profile,
"stack-id": stack_id,
"stack-name": stack_name,
}
for tag in stack_props["Tags"]:
k, v = (tag["Key"], tag["Value"])
if k.startswith("taskcat-"):
stack[k] = v
if stack.get("taskcat-id"):
stack["taskcat-id"] = uuid.UUID(stack["taskcat-id"])
stacks.append(stack)
except Exception as e: # pylint: disable=broad-except
LOG.warning(
f"Failed to fetch stacks for region {region} using profile "
f"{profile} {type(e)} {e}"
)
LOG.debug("Traceback:", exc_info=True)
return stacks