def _wait_for_changeset()

in aws_codeseeder/services/cfn.py [0:0]


def _wait_for_changeset(changeset_id: str, stack_name: str) -> bool:
    waiter = boto3_client("cloudformation").get_waiter("change_set_create_complete")
    waiter_config = {"Delay": 1}
    try:
        waiter.wait(ChangeSetName=changeset_id, StackName=stack_name, WaiterConfig=waiter_config)
    except botocore.exceptions.WaiterError as ex:
        resp = ex.last_response
        status = resp["Status"]
        reason = resp["StatusReason"]
        if (
            status == "FAILED"
            and "The submitted information didn't contain changes." in reason
            or "No updates are to be performed" in reason
        ):
            LOGGER.debug(f"No changes for {stack_name} CloudFormation stack.")
            return False
        raise RuntimeError(f"Failed to create the changeset: {ex}. Status: {status}. Reason: {reason}")
    return True