(file, check)
return has_failed
Determines if integration with http wrapper class
    uses the http template in its spec.yaml file.

    file -- filepath of file to validate
    check -- name of the check that file belongs to
Determines if integration with http wrapper class
    uses the http template in its spec.yaml file.
Determines if integration with http wrapper class uses the http template in its spec . yaml file .
def validate_config_http(file, check):
    """Determines if integration with http wrapper class
    uses the http template in its spec.yaml file.

    file -- filepath of file to validate
    check -- name of the check that file belongs to
    """

    if not os.path.exists(file):
        return

    has_failed = False
    with open(file, 'r', encoding='utf-8') as f:
        read_file = f.read()
        has_init_config_http = re.search(HTTP_WRAPPER_INIT_CONFIG_RE, read_file)
        has_instance_http = re.search(HTTP_WRAPPER_INSTANCE_RE, read_file)
        if has_init_config_http and has_instance_http:
            return

    if not has_instance_http:
        message = (
            f"Detected {check} is missing `instances/http` or `instances/openmetrics_legacy` template in spec.yaml"
        )
        echo_failure(message)
        annotate_error(file, message)
        has_failed = True

    if not has_init_config_http:
        message = (
            f"Detected {check} is missing `init_config/http` or `init_config/openmetrics_legacy` template in spec.yaml"
        )
        echo_failure(message)
        annotate_error(file, message)
        has_failed = True

    return has_failed
def validate_config_http ( file , check ) : if not os . path . exists ( file ) : return has_failed = False with open ( file , 'r' , encoding = 'utf-8' ) as f : read_file = f . read ( ) has_init_config_http = re . search ( HTTP_WRAPPER_INIT_CONFIG_RE , read_file ) has_instance_http = re . search ( HTTP_WRAPPER_INSTANCE_RE , read_file ) if has_init_config_http and has_instance_http : return if not has_instance_http : message = ( f"Detected {check} is missing `instances/http` or `instances/openmetrics_legacy` template in spec.yaml" ) echo_failure ( message ) annotate_error ( file , message ) has_failed = True if not has_init_config_http : message = ( f"Detected {check} is missing `init_config/http` or `init_config/openmetrics_legacy` template in spec.yaml" ) echo_failure ( message ) annotate_error ( file , message ) has_failed = True return has_failed