Returns a list of tags for every host that is detected by the vSphere
        integration.

        Returns a list of pairs (hostname, {'SOURCE_TYPE: list_of_tags},)
358475
def get_external_host_tags(self):
        
        self.log.debug("Sending external_host_tags now")
        external_host_tags = []
        for instance in self.instances:
            i_key = self._instance_key(instance)
            if not self.mor_cache.contains(i_key):
                self.log.warning("Unable to extract host tags for vSphere instance: {}".format(i_key))
                continue

            for _, mor in self.mor_cache.mors(i_key):
                # Note: some mors have a None hostname
                hostname = mor.get('hostname')
                if hostname:
                    external_host_tags.append((hostname, {SOURCE_TYPE: mor.get('tags')}))

        return external_host_tags
949606
def tags(self):
        # type: () -> Set[str]
        
        tags = set()
        if self._tags:
            tags.update(self._tags)
        if self.binding:
            binding_tags = getattr(self.binding, 'tags', None)
            if binding_tags:
                tags.update(binding_tags)
        return tags
40422
def collect_hosts(hosts, randomize=True):
    

    if isinstance(hosts, six.string_types):
        hosts = hosts.strip().split(',')

    result = []
    afi = socket.AF_INET
    for host_port in hosts:

        host, port, afi = get_ip_port_afi(host_port)

        if port < 0:
            port = DEFAULT_KAFKA_PORT

        result.append((host, port, afi))

    if randomize:
        shuffle(result)

    return result
767516
def _get_tags(self):
        # type: () -> List[str]
        
        tags = self.data.get('tags', None)
        if not tags:
            return list()
        return [x['name'] for x in tags]
283226
def _tag_ebs(self, conn, role):
        
        tags = {'Name': 'spilo_' + self.cluster_name, 'Role': role, 'Instance': self.instance_id}
        volumes = conn.get_all_volumes(filters={'attachment.instance-id': self.instance_id})
        conn.create_tags([v.id for v in volumes], tags)
208881
def host_events(self, host):
        '''
        
        '''
        all_host_events = filter(lambda x: 'event_data' in x and 'host' in x['event_data'] and x['event_data']['host'] == host,
                                 self.events)
        return all_host_events
1137067
def get_tags(self, name):
        
        tags = list()
        for tag in self._tags:
            if tag[0] == name:
                tags.append(tag[1])

        return tags
18911
def list_tags(self):
        
        from highton.models.tag import Tag
        return fields.ListField(
            name=self.ENDPOINT,
            init_class=Tag
        ).decode(
            self.element_from_string(
                self._get_request(
                    endpoint=self.ENDPOINT + '/' + str(self.id) + '/' + Tag.ENDPOINT,
                ).text
            )
        )
939475
def list_domains():
    '''
    
    '''
    with _get_xapi_session() as xapi:
        hosts = xapi.VM.get_all()
        ret = []

        for _host in hosts:
            if xapi.VM.get_record(_host)['is_control_domain'] is False:
                ret.append(xapi.VM.get_name_label(_host))

        return ret
582241
def list_tags(Name,
           region=None, key=None, keyid=None, profile=None):
    '''
    

    '''

    try:
        conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
        rid = _get_trail_arn(Name,
                             region=region, key=key, keyid=keyid,
                             profile=profile)
        ret = conn.list_tags(ResourceIdList=[rid])
        tlist = ret.get('ResourceTagList', []).pop().get('TagsList')
        tagdict = {}
        for tag in tlist:
            tagdict[tag.get('Key')] = tag.get('Value')
        return {'tags': tagdict}
    except ClientError as e:
        return {'error': __utils__['boto3.get_error'](e)}
536712
private List<String> getTagsFromMetricGroup(MetricGroup metricGroup) {
		List<String> tags = new ArrayList<>();

		for (Map.Entry<String, String> entry: metricGroup.getAllVariables().entrySet()) {
			if (!entry.getKey().equals(HOST_VARIABLE)) {
				tags.add(getVariableName(entry.getKey()) + ":" + entry.getValue());
			}
		}

		return tags;
	}
351374
def tags(self):
        
        tags = set()
        for i in self:
            tags |= set(i.keys())
        return tags
913929
def list_nictags(include_etherstubs=True):
    '''
    
    '''
    ret = {}
    cmd = 'nictagadm list -d "|" -p{0}'.format(
        ' -L' if not include_etherstubs else ''
    )
    res = __salt__['cmd.run_all'](cmd)
    retcode = res['retcode']
    if retcode != 0:
        ret['Error'] = res['stderr'] if 'stderr' in res else 'Failed to get list of nictags.'
    else:
        header = ['name', 'macaddress', 'link', 'type']
        for nictag in res['stdout'].splitlines():
            nictag = nictag.split('|')
            nictag_data = {}
            for field in header:
                nictag_data[field] = nictag[header.index(field)]
            ret[nictag_data['name']] = nictag_data
            del ret[nictag_data['name']]['name']
    return ret
134973
def _get_hosts(self, patterns):
        

        hosts = set()
        for p in patterns:
            if p.startswith("!"):
                # Discard excluded hosts
                hosts.difference_update(self.__get_hosts(p))
            elif p.startswith("&"):
                # Only leave the intersected hosts
                hosts.intersection_update(self.__get_hosts(p))
            else:
                # Get all hosts from both patterns
                hosts.update(self.__get_hosts(p))
        return hosts
157637
def __get_tags(vm_):
    '''
    
    '''
    t = config.get_cloud_config_value(
        'tags', vm_, __opts__,
        default='[]', search_global=False)
    # Consider warning the user that the tags in the cloud profile
    # could not be interpreted, bad formatting?
    try:
        tags = literal_eval(t)
    except Exception:  # pylint: disable=W0703
        tags = None
    if not tags or not isinstance(tags, list):
        tags = None
    return tags
788562
def getHostsFromSGE():
    """"""
    with open(os.environ["PE_HOSTFILE"], 'r') as hosts:
        return [(host.split()[0], int(host.split()[1])) for host in hosts]
1151306
def collect_hosts(api, wanted_hostnames):
  
  all_hosts = api.get_all_hosts(view='full')
  all_hostnames = set([ h.hostname for h in all_hosts])
  wanted_hostnames = set(wanted_hostnames)

  unknown_hosts = wanted_hostnames.difference(all_hostnames)
  if len(unknown_hosts) != 0:
    msg = "The following hosts are not found in Cloudera Manager. "\
          "Please check for typos:\n%s" % ('\n'.join(unknown_hosts))
    LOG.error(msg)
    raise RuntimeError(msg)

  return [ h for h in all_hosts if h.hostname in wanted_hostnames ]