Find a server by its name
519177
def server_by_name(self, name):
        '''
        
        '''
        return self.server_show_libcloud(
            self.server_list().get(name, {}).get('id', '')
        )
1268044
public static final void serverName(String name)
    {
        if (tc.isEntryEnabled())
            Tr.entry(tc, "serverName", name);

        _serverName = name;

        if (tc.isEntryEnabled())
            Tr.exit(tc, "serverName");
    }
208235
def find_network!(name)
      network = find_network(name)
      return network unless network.nil?

      raise CommandError, "a network with the name #{name.inspect} " \
                          'does not exist'
    end
548151
def get_server(key, server=MAIN_SERVER, servers=LOAD_SERVERS):

    

    namecoind = NamecoindClient(NAMECOIND_SERVER, NAMECOIND_PORT,
                                NAMECOIND_USER, NAMECOIND_PASSWD)

    info = namecoind.name_show(key)

    if 'address' in info:
        return check_address(info['address'], server, servers)

    response = {}
    response["registered"] = False
    response["server"] = None
    response["ismine"] = False
    return response
913372
def get_servers_by_deployment(names)
      servers = []
      all_instances = Connection.all_instances

      if @exact
        result = all_instances.select {|i| names.any? {|n| i['links']['deployment']['name'].eql? n }}
      else
        result = all_instances.select {|i| names.any? {|n| i['links']['deployment']['name'] =~ /#{n}/ }}
      end
      servers = result

      return(servers)
    end
1257032
def vserver_exists(v_name, v_ip=None, v_port=None, v_type=None, **connection_args):
    '''
    
    '''
    vserver = _vserver_get(v_name, **connection_args)
    if vserver is None:
        return False
    if v_ip is not None and vserver.get_ipv46() != v_ip:
        return False
    if v_port is not None and vserver.get_port() != v_port:
        return False
    if v_type is not None and vserver.get_servicetype().upper() != v_type.upper():
        return False
    return True
732301
def servers(self):
        """"""
        url = "%s/servers" % self.root
        return Servers(url=url,
                       securityHandler=self._securityHandler,
                       proxy_url=self._proxy_url,
                       proxy_port=self._proxy_port)
106138
public function server($name = null)
    {
        $value = $name === null ? $this->server : null;

        $server = (array) $this->server;

        isset($server[$name]) && $value = $server[$name];

        return $value;

        // getServerParams
    }
44527
private MBeanServer getServerForName(String name) {
        try {
            MBeanServer mbeanServer = null;
            final ObjectName objectNameQuery = new ObjectName(name + ":type=Service,*");

            for (final MBeanServer server : MBeanServerFactory.findMBeanServer(null)) {
                if (server.queryNames(objectNameQuery, null).size() > 0) {
                    mbeanServer = server;
                    // we found it, bail out
                    break;
                }
            }

            return mbeanServer;
        } catch (Exception e) {
        }

        return null;
    }
1090230
public boolean isServerPath(String name)
    {
        name=name.replace('/','.');
        while(name.startsWith("."))
            name=name.substring(1);

        String[] server_classes=_context.getServerClasses();
        
        if (server_classes!=null)
        {
            for (int i=0;i<server_classes.length;i++)
            {
                boolean result=true;
                String c=server_classes[i];
                if (c.startsWith("-"))
                {
                    c=c.substring(1);
                    result=false;
                }
                
                if (c.endsWith("."))
                {
                    if (name.startsWith(c))
                        return result;
                }
                else if (name.equals(c))
                {
                    return result;
                }
            }
        }
        return false;
    }
888522
def guess_server_name():
    """"""
    if   os.environ.get('CSCSERVICE')          == 'sisu':         return "sisu"
    elif os.environ.get('SLURM_JOB_PARTITION') == 'halvan':       return "halvan"
    elif os.environ.get('SNIC_RESOURCE')       == 'milou':        return "milou"
    elif os.environ.get('LAPTOP')              == 'macbook_air':  return "macbook_air"
    else:                                                         return "unknown"
1079330
def lookup_server(req)
      @virtual_hosts.find{|s|
        (s[:BindAddress].nil? || req.addr[3] == s[:BindAddress]) &&
        (s[:Port].nil?        || req.port == s[:Port])           &&
        ((s[:ServerName].nil?  || req.host == s[:ServerName]) ||
         (!s[:ServerAlias].nil? && s[:ServerAlias].find{|h| h === req.host}))
      }
    end
1216907
def lookupByName(self, name):
        
        res = yield queue.executeInThread(self.connection.lookupByName, name)
        return self.DomainClass(self, res)
1026982
def server(name=None, description=None, **kwargs):
    '''
    '''
    return UdpSocketServer(
        EchoServerProtocol,
        name=name or 'echoudpserver',
        description=description or 'Echo Udp Server',
        **kwargs
    )
516674
function (server_name, onDone) {

	// check if cached server info exists	
	if (l_servers.hasOwnProperty(server_name)) {
		var server = l_servers[server_name];
		
		LOG.warn('cache exists: ', 'Entry');
		LOG.warn(server, 'Entry');
		UTIL.safeCall(onDone, server);
	}
	else {
		
		// seek server IP/port info from monitor
		//l_queryServer(server_name, function (result) {
		//SR.Script['handler'].queryServer(server_name, function (result) {
		//g_handler.queryServer(server_name, function (result) {
		SR.API.queryServer({name: server_name}, function (err, result) {
			
			if (err) {
				return LOG.error(err);	
			}
			
			if (result && result.length > 0) {
				// TODO: pick a random one if more than one choices OR choose based on loading?
				var index = UTIL.randInteger(result.length);
				var info = result[index];
			
				var server = {IP: info.IP, port: info.port}
				l_servers[server_name] = server;
				onDone(server);
			}
			else
				onDone();
		});
	}	
}
868413
def get_server_by_ip(self, ip_address):
        
        data = self.get_request('/ip_address/{0}'.format(ip_address))
        UUID = data['ip_address']['server']
        return self.get_server(UUID)
220046
def show_instance(name, call=None):
    '''
    
    '''
    response = _query('grid', 'server/get', args={'name': name})
    ret = {}
    for item in response['list']:
        name = item['name']
        ret[name] = item

        ret[name]['image_info'] = item['image']
        ret[name]['image'] = item['image']['friendlyName']
        ret[name]['size'] = item['ram']['name']
        ret[name]['public_ips'] = [item['ip']['ip']]
        ret[name]['private_ips'] = []
        ret[name]['state_info'] = item['state']
        if 'active' in item['state']['description']:
            ret[name]['state'] = 'RUNNING'
    return ret