Return information about the host connected to this master
769288
def host_info(host=None):
    '''
    
    '''
    data = query(host, quiet=True)
    for id_ in data:
        if 'vm_info' in data[id_]:
            data[id_].pop('vm_info')
    __jid_event__.fire_event({'data': data, 'outputter': 'nested'}, 'progress')
    return data
1080707
def fetch_host_ip(host: str) -> str:
    
    try:
        ip = socket.gethostbyname(host)
    except socket.gaierror:
        return ''

    return ip
557784
def __get_host(node, vm_):
    '''
    
    '''
    if __get_ssh_interface(vm_) == 'private_ips' or vm_['external_ip'] is None:
        ip_address = node.private_ips[0]
        log.info('Salt node data. Private_ip: %s', ip_address)
    else:
        ip_address = node.public_ips[0]
        log.info('Salt node data. Public_ip: %s', ip_address)

    if ip_address:
        return ip_address

    return node.name
669216
def hostname(self):
    """"""
    hostname_artifact = self._hostnames.get(self.CURRENT_SESSION, None)
    if not hostname_artifact:
      return ''

    return hostname_artifact.name or ''
506119
def info(self):
        """"""
        backend_cls = self.backend_cls or "amqplib"
        port = self.port or self.create_backend().default_port
        return {"hostname": self.hostname,
                "userid": self.userid,
                "password": self.password,
                "virtual_host": self.virtual_host,
                "port": port,
                "insist": self.insist,
                "ssl": self.ssl,
                "transport_cls": backend_cls,
                "backend_cls": backend_cls,
                "connect_timeout": self.connect_timeout}
62036
def get_host(self):
        
        import socket
        host_name = socket.gethostname()
        for h in hosts:
            if h['name'] == host_name:
                return h['type'], h['name']
        return dict(type='Unknown', name=host_name)
375012
def _getaddrinfo(self, host: str, family: int=socket.AF_UNSPEC) \
            -> List[tuple]:
        '''
        '''
        event_loop = asyncio.get_event_loop()
        query = event_loop.getaddrinfo(host, 0, family=family,
                                       proto=socket.IPPROTO_TCP)

        if self._timeout:
            query = asyncio.wait_for(query, self._timeout)

        try:
            results = yield from query
        except socket.error as error:
            if error.errno in (
                    socket.EAI_FAIL,
                    socket.EAI_NODATA,
                    socket.EAI_NONAME):
                raise DNSNotFound(
                    'DNS resolution failed: {error}'.format(error=error)
                ) from error
            else:
                raise NetworkError(
                    'DNS resolution error: {error}'.format(error=error)
                ) from error
        except asyncio.TimeoutError as error:
            raise NetworkError('DNS resolve timed out.') from error
        else:
            return results
955252
def request_server_info(self):
        ''' 

        '''
        if self._server_info is None:
            self._server_info = self._send_request_server_info()
        return self._server_info
1030280
def get_host_physnet(self, context):
        
        host_id = utils.hostname(context.host)
        cmd = ['show network physical-topology neighbors']
        try:
            response = self._run_eos_cmds(cmd)
            # Get response for 'show network physical-topology neighbors'
            # command
            neighbors = response[0]['neighbors']
            for neighbor in neighbors:
                if host_id in neighbor:
                    physnet = neighbors[neighbor]['toPort'][0]['hostname']
                    LOG.debug("get_physical_network: Physical Network for "
                              "%(host)s is %(physnet)s", {'host': host_id,
                                                          'physnet': physnet})
                    return physnet
            LOG.debug("Physical network not found for %(host)s",
                      {'host': host_id})
        except Exception as exc:
            LOG.error(_LE('command %(cmd)s failed with '
                      '%(exc)s'), {'cmd': cmd, 'exc': exc})
        return None
1077558
def get_master(self, host, port, sentinel_port, sentinel_name):
        
        if sentinel_port and sentinel_name:
            master = Sentinel([(host, sentinel_port)], socket_timeout=1)\
                .discover_master(sentinel_name)
            return master
        return host, port
745572
def get_connection(self, host, port, db):
        
        return redis.StrictRedis(
            host=host,
            port=port,
            db=db,
            decode_responses=True
        )
322718
def get_control_connection_host(self):
        
        connection = self.control_connection._connection
        endpoint = connection.endpoint if connection else None
        return self.metadata.get_host(endpoint) if endpoint else None
1107826
def get_host(self, use_x_forwarded=True):
        """"""
        # We try three options, in order of decreasing preference.
        if use_x_forwarded and ('HTTP_X_FORWARDED_HOST' in self.environ):
            host = self.environ['HTTP_X_FORWARDED_HOST']
            port = self.environ.get('HTTP_X_FORWARDED_PORT')
            if port and port != ('443' if self.is_secure else '80'):
                host = '%s:%s' % (host, port)
            return host
        elif 'HTTP_HOST' in self.environ:
            host = self.environ['HTTP_HOST']
        else:
            # Reconstruct the host using the algorithm from PEP 333.
            host = self.environ['SERVER_NAME']
            server_port = str(self.environ['SERVER_PORT'])
            if server_port != ('443' if self.is_secure else '80'):
                host = '%s:%s' % (host, server_port)
        return host
1345633
private Map<String, Object> getConnectionInfo() {
        String[] hostnames = (String[]) props.get(HOST_NAMES);
        int[] ports = (int[]) props.get(PORTS);

        String hostname = (hostnames == null || hostnames.length < 1) ? null : hostnames[0];
        String port = (ports == null || ports.length < 1) ? null : String.valueOf(ports[0]);

        return sslHelper.getConnectionInfo(hostname, port);
    }
1330547
def get_my_info():
    
    result = {}
    result['host_name'] = platform.node()
    result['real_host_name'] = platform.node()
    result['dist'] = platform.dist()
    result['nago_version'] = nago.get_version()
    return result
4282
def info(hosts=None, profile=None):
    '''
    
    '''
    es = _get_instance(hosts, profile)

    try:
        return es.info()
    except elasticsearch.TransportError as e:
        raise CommandExecutionError("Cannot retrieve server information, server returned code {0} with message {1}".format(e.status_code, e.error))
653707
def _get_esxi_proxy_details():
    '''
    
    '''
    det = __proxy__['esxi.get_details']()
    host = det.get('host')
    if det.get('vcenter'):
        host = det['vcenter']
    esxi_hosts = None
    if det.get('esxi_host'):
        esxi_hosts = [det['esxi_host']]
    return host, det.get('username'), det.get('password'), \
            det.get('protocol'), det.get('port'), det.get('mechanism'), \
            det.get('principal'), det.get('domain'), esxi_hosts