Get the maintenance state of a host
 @param n [String] the node
 @param options [Hash] :dc string for dc specific query
 @return [Hash] { :enabled => true, :reason => 'foo' }
198852
def enabled(n, options = {})
      health = Diplomat::Health.new(@conn)
      result = health.node(n, options)
                     .select { |check| check['CheckID'] == '_node_maintenance' }

      if result.empty?
        { enabled: false, reason: nil }
      else
        { enabled: true, reason: result.first['Notes'] }
      end
    end
885198
def enter_maintenance_mode(self):
    
    cmd = self._cmd('enterMaintenanceMode')
    if cmd.success:
      self._update(_get_service(self._get_resource_root(), self._path()))
    return cmd
552003
def connection_options(opts)
      connection_options = {
        logger:                 logger,
        user_known_hosts_file:  '/dev/null',
        hostname:               opts[:host],
        port:                   opts[:port],
        username:               opts[:user],
        compression:            opts[:compression],
        compression_level:      opts[:compression_level],
        keepalive:              opts[:keepalive],
        keepalive_interval:     opts[:keepalive_interval],
        timeout:                opts[:connection_timeout],
        connection_retries:     opts[:connection_retries],
        connection_retry_sleep: opts[:connection_retry_sleep],
        max_wait_until_ready:   opts[:max_wait_until_ready],
        auth_methods:           opts[:auth_methods],
        keys_only:              opts[:keys_only],
        keys:                   opts[:key_files],
        password:               opts[:password],
        forward_agent:          opts[:forward_agent],
        proxy_command:          opts[:proxy_command],
        bastion_host:           opts[:bastion_host],
        bastion_user:           opts[:bastion_user],
        bastion_port:           opts[:bastion_port],
        non_interactive:        opts[:non_interactive],
        transport_options:      opts,
      }
      # disable host key verification. The hash key and value to use
      # depends on the version of net-ssh in use.
      connection_options[verify_host_key_option] = verify_host_key_value(opts[:verify_host_key])

      connection_options
    end
1346838
def node_healthy?(hostname, services = [], iterations = 60)
      print "Waiting for #{hostname} to become healthy"
      services = services.reject { |s| get_service_check(s).empty? }.freeze

      iterations.times do
        print '.'

        checks = hostname_health_checks(hostname)

        has_services = (services - checks.map { |c| c['ServiceName'] }).empty?
        passing_checks = checks.all? { |c| c['Status'] == 'passing' }

        if !checks.empty? && has_services && passing_checks
          unless services.empty?
            print " Services: #{services.join(', ').inspect} Healthy and".green
          end

          puts ' Node Healthy!'.green
          return true
        end

        sleep(6)
      end

      false
    end
1273022
def get_complex_or_node_state(self, hosts, services):
        
        # First we get the state of all our sons
        states = [s.get_state(hosts, services) for s in self.sons]
        # Next we calculate the best state
        best_state = min(states)
        # Then we handle eventual not value
        if self.not_value:
            return self.get_reverse_state(best_state)
        return best_state
1084987
function(n) {
		"use strict";

		if (arguments.length === 0) {
			n = 1;
		}
		return this.getDomain(this.jumpDate(this.getDomainKeys().shift(), -n, this.options.domain), 1)[0];
	}
438143
def maintenance(self, on=True):
        """"""

        r = self._h._http_resource(
            method='POST',
            resource=('apps', self.name, 'server', 'maintenance'),
            data={'maintenance_mode': int(on)}
        )
        return r.ok
844213
def is_available_extension(name,
                           user=None,
                           host=None,
                           port=None,
                           maintenance_db=None,
                           password=None,
                           runas=None):
    '''
    

    '''
    exts = available_extensions(user=user,
                                host=host,
                                port=port,
                                maintenance_db=maintenance_db,
                                password=password,
                                runas=runas)
    if name.lower() in [
        a.lower()
        for a in exts
    ]:
        return True
    return False
953485
def get_status(self, hosts, services):
        

        if self.got_business_rule:
            mapping = {
                0: u'OK',
                1: u'WARNING',
                2: u'CRITICAL',
                3: u'UNKNOWN',
                4: u'UNREACHABLE',
            }
            return mapping.get(self.business_rule.get_state(hosts, services), "n/a")

        return self.state
1030696
def DbGetHostServersInfo(self, argin):
        
        self._log.debug("In DbGetHostServersInfo()")
        argin = replace_wildcard(argin)
        return self.db.get_host_servers_info(argin)
1110957
public boolean checkIfChanged(Collection<Host> hostsUp, Collection<Host> hostsDown) {
		boolean changed = activeSetChanged(hostsUp) || inactiveSetChanged(hostsUp, hostsDown);

		if (changed && logger.isDebugEnabled()) {
			Set<Host> changedHostsUp = new HashSet<>(hostsUp);
			changedHostsUp.removeAll(activeHosts);
			changedHostsUp.forEach(x -> logger.debug("New host up: {}", x.getHostAddress()));

			Set<Host> changedHostsDown = new HashSet<>(hostsDown);
			changedHostsDown.removeAll(inactiveHosts);
			changedHostsDown.forEach(x -> logger.debug("New host down: {}", x.getHostAddress()));
		}
		return changed;
	}
474795
function HostListOptions(options) {
  if (!(this instanceof HostListOptions))
    return new HostListOptions(options);

  this.network = Network.primary;
  this.logger = Logger.global;
  this.resolve = dns.lookup;
  this.host = '0.0.0.0';
  this.port = this.network.port;
  this.services = common.LOCAL_SERVICES;
  this.onion = false;
  this.banTime = common.BAN_TIME;

  this.address = new NetAddress();
  this.address.services = this.services;
  this.address.time = this.network.now();

  this.seeds = this.network.seeds;
  this.nodes = [];

  this.maxBuckets = 20;
  this.maxEntries = 50;

  this.prefix = null;
  this.filename = null;
  this.persistent = false;
  this.flushInterval = 120000;

  if (options)
    this.fromOptions(options);
}
529365
def options
      @options ||= {
        BindAddress: app.config[:host],
        Port: app.config[:port],
        StartCallback: proc { app.on_start },
        StopCallback: proc { app.on_stop },
        OutputBufferSize: 5,
        AccessLog: [[logdev, WEBrick::AccessLog::COMMON_LOG_FORMAT]],
        Logger: WEBrick::Log.new(logdev)
      }
    end
1277047
def parse_options(options)
      headers = nil
      query_params = []
      url_prefix = nil
      consistency = []

      # Parse options used as header
      headers = { 'X-Consul-Token' => configuration.acl_token } if configuration.acl_token
      headers = { 'X-Consul-Token' => options[:token] } if options[:token]

      # Parse options used as query params
      consistency = 'stale' if options[:stale]
      consistency = 'leader' if options[:leader]
      consistency = 'consistent' if options[:consistent]
      query_params << consistency

      # Parse url host
      url_prefix = options[:http_addr] if options[:http_addr]
      { query_params: query_params, headers: headers, url_prefix: url_prefix }
    end
1010041
function getStatus(localHash: string, cacheHash: ?string): string {
  if (!cacheHash) {
    return LocalStatus.New;
  }

  return localHash === cacheHash
    ? LocalStatus.Unchanged
    : LocalStatus.Changed;
}
715093
def get_server_fqdn(server)
      return nil unless server

      nic = get_server_default_nic(server) || {}
      networks = list_networks || {}

      id = nic['networkid']
      network = networks.select { |net|
        net['id'] == id
      }.first
      return nil unless network

      "#{server['name']}.#{network['networkdomain']}"
    end
455368
def verify_unused(names) # :nodoc:
      names.each do |name|
        verify_unused_in_option(name,flags,"flag")
        verify_unused_in_option(name,switches,"switch")
      end
    end