Disable checks for a host
        Format of the line that triggers function call::

        DISABLE_HOST_CHECK;<host_name>

        :param host: host to edit
        :type host: alignak.objects.host.Host
        :return: None
354113
def disable_host_check(self, host):
        
        if host.active_checks_enabled:
            host.modified_attributes |= DICT_MODATTR["MODATTR_ACTIVE_CHECKS_ENABLED"].value
            host.disable_active_checks(self.daemon.checks)
            self.send_an_element(host.get_update_status_brok())
719472
def disable_vuln_check(check_id)
      checks = REXML::XPath.first(@xml, '//VulnerabilityChecks')
      checks.elements.delete("Enabled/Check[@id='#{check_id}']")
      disabled_checks = checks.elements['Disabled'] || checks.add_element('Disabled')
      disabled_checks.add_element('Check', { 'id' => check_id })
    end
1063050
def disable_checker_on_env(func):
    
    @wraps(func)
    def func_wrapper(*args, **kwargs):
        # pylint: disable=C0111, C0103
        function_name = func.__name__
        CHECKERS_DISABLED = os.getenv('CHECKERS_DISABLED', '')
        disabled_functions = [x.strip() for x in CHECKERS_DISABLED.split(',')]

        force_run = kwargs.get('force_run', False)

        if function_name in disabled_functions and not force_run:
            return True
        else:
            return func(*args, **kwargs)

    return func_wrapper
203329
public static String normalizeHost(String host) {
        // if it is normalized IPv6 or could not be IPv6, return
        if (host.isEmpty() || host.charAt(0) == '[' || host.indexOf(':') < 0)
            return host;

        // normalize with [ ]
        return "[" + host + "]";
    }
615005
def enable_host_event_handler(self, host):
        
        if not host.event_handler_enabled:
            host.modified_attributes |= \
                DICT_MODATTR["MODATTR_EVENT_HANDLER_ENABLED"].value
            host.event_handler_enabled = True
            self.send_an_element(host.get_update_status_brok())
1028739
def disable_host_svc_checks(self, host):
        
        for service_id in host.services:
            if service_id in self.daemon.services:
                service = self.daemon.services[service_id]
                self.disable_svc_check(service)
                self.send_an_element(service.get_update_status_brok())
929299
def disable_host_notifications(self, host):
        
        if host.notifications_enabled:
            host.modified_attributes |= DICT_MODATTR["MODATTR_NOTIFICATIONS_ENABLED"].value
            host.notifications_enabled = False
            self.send_an_element(host.get_update_status_brok())
348918
private boolean isNonProxyHost(String host, String nonProxyHosts) {
        if (host == null || nonProxyHosts == null) {
            return false;
        }

        // construct pattern
        StringBuilder patternBuilder = new StringBuilder();
        for (int i = 0; i < nonProxyHosts.length(); i++) {
            char c = nonProxyHosts.charAt(i);
            switch (c) {
            case '.':
                patternBuilder.append("\\.");
                break;
            case '*':
                patternBuilder.append(".*");
                break;
            default:
                patternBuilder.append(c);
            }
        }
        // check whether the host is the nonProxyHosts.
        String pattern = patternBuilder.toString();
        return host.matches(pattern);
    }
1080989
def valid_hosts(hosts):
    
    if _empty.match(hosts):
        return False

    for host in hosts.split(","):
        if not valid_host_with_port(host):
            return False

    return True
230544
def enable_host_check(self, host):
        
        if not host.active_checks_enabled:
            host.active_checks_enabled = True
            host.modified_attributes |= \
                DICT_MODATTR["MODATTR_ACTIVE_CHECKS_ENABLED"].value
            self.send_an_element(host.get_update_status_brok())
915534
def filter_host_by_regex(regex):
    
    host_re = re.compile(regex)

    def inner_filter(items):
        """Inner filter for host. Accept if regex match host_name"""
        host = items["host"]
        if host is None:
            return False
        return host_re.match(host.host_name) is not None

    return inner_filter
649511
def disable_host_freshness_check(self, host):
        
        if host.check_freshness:
            host.modified_attributes |= DICT_MODATTR["MODATTR_FRESHNESS_CHECKS_ENABLED"].value
            host.check_freshness = False
            self.send_an_element(host.get_update_status_brok())
1120378
def validate_host(cert, name):
    
    cn = None
    for t, v in cert.get_subject().get_components():
        if t == b'CN':
            cn = v
            break

    if cn == name:
        return True

    # checking SAN
    s_name = name.decode('ascii')
    for i in range(cert.get_extension_count()):
        ext = cert.get_extension(i)
        if ext.get_short_name() == b'subjectAltName':
            s = str(ext)
            # SANs are usually have form like: DNS:hostname
            if s.startswith('DNS:') and s[4:] == s_name:
                return True

    # TODO handle wildcards
    return False
966022
def start_executing_host_checks(self):
        
        # todo: #783 create a dedicated brok for global parameters
        if not self.my_conf.execute_host_checks:
            self.my_conf.modified_attributes |= DICT_MODATTR["MODATTR_ACTIVE_CHECKS_ENABLED"].value
            self.my_conf.execute_host_checks = True
            self.my_conf.explode_global_conf()
            self.daemon.update_program_status()
1154614
def disable_host_event_handler(self, host):
        
        if host.event_handler_enabled:
            host.modified_attributes |= DICT_MODATTR["MODATTR_EVENT_HANDLER_ENABLED"].value
            host.event_handler_enabled = False
            self.send_an_element(host.get_update_status_brok())
74725
def valid_hostname(host):
    
    if len(host) > 255:
        return False

    if host[-1:] == '.':
        host = host[:-1]

    return all(_hostname_re.match(c) for c in host.split('.'))
802665
def filter_host_by_name(name):
    

    def inner_filter(items):
        """Inner filter for host. Accept if host_name == name"""
        host = items["host"]
        if host is None:
            return False
        return host.host_name == name

    return inner_filter