Ejemplo n.º 1
0
def check_no_pending_csr():
    """
    Check whether we have any pending CSRs.

    Raises:
        exceptions.PendingCSRException

    """
    logger.info("Checking for Pending CSRs")
    pending_csrs = get_pending_csr()
    logger.debug(f"pending CSRs: {pending_csrs}")
    if pending_csrs:
        logger.warning(f"{pending_csrs} are not Approved")
        approve_csrs(pending_csrs)
        raise exceptions.PendingCSRException("Some CSRs are in 'Pending' state")
Ejemplo n.º 2
0
def check_no_pending_csr():
    """
    Check whether we have any pending CSRs.

    Raises:
        exceptions.PendingCSRException

    """
    logger.info("Checking for Pending CSRs")
    csr_conf = get_csr_resource()
    pending = False
    for item in csr_conf.data.get('items'):
        if item.get('status') == {}:
            logger.warning(
                f"{item.get('metadata').get('name')} is not Approved"
            )
            pending = True
    if pending:
        raise exceptions.PendingCSRException(
            "Some CSRs are in 'Pending' state"
        )