def disable_autorotate_without_endpoint():
    """
    This function automatically disables auto-rotation for unexpired certificates that are
    not attached to an endpoint but have autorotate enabled.

    WARNING: This will overwrite the Auto-rotate toggle!
    """
    log_data = {
        "function": f"{__name__}.{sys._getframe().f_code.co_name}",
        "message": "Disabling auto-rotate for certificate"
    }

    eligible_certs = get_all_certs_not_attached_to_endpoint_with_autorotate()
    for cert in eligible_certs:

        if not current_app.config.get("DISABLE_AUTOROTATION_FILTER") or not current_app.config.get("DISABLE_AUTOROTATION_FILTER")(cert):
            continue

        log_data["certificate"] = cert.name
        log_data["certificate_id"] = cert.id
        log_data["authority_id"] = cert.authority_id
        log_data["authority_name"] = "unknown"
        authority = authorities_get_by_id(cert.authority_id)
        if authority:
            log_data["authority_name"] = authority.name
        log_data["destination_names"] = "NONE"
        current_app.logger.info(log_data)
        metrics.send("automatically_disable_autorotate_without_endpoint",
                     "counter", 1,
                     metric_tags={"certificate": log_data["certificate"],
                                  "certificate_id": log_data["certificate_id"],
                                  "authority_id": log_data["authority_id"],
                                  "authority_name": log_data["authority_name"],
                                  "destination_names": log_data["destination_names"]
                                  })
        cert.rotation = False
        database.update(cert)

    This function automatically disables auto-rotation for unexpired certificates that are
    not attached to an endpoint but have autorotate enabled.

    WARNING: This will overwrite the Auto-rotate toggle!
    
lemur/certificates/cli.py