Return a list of available flavors (nova flavor-list)
359625
def flavor_list(self, **kwargs):
        '''
        
        '''
        nt_ks = self.compute_conn
        ret = {}
        for flavor in nt_ks.flavors.list(**kwargs):
            links = {}
            for link in flavor.links:
                links[link['rel']] = link['href']
            ret[flavor.name] = {
                'disk': flavor.disk,
                'id': flavor.id,
                'name': flavor.name,
                'ram': flavor.ram,
                'swap': flavor.swap,
                'vcpus': flavor.vcpus,
                'links': links,
            }
            if hasattr(flavor, 'rxtx_factor'):
                ret[flavor.name]['rxtx_factor'] = flavor.rxtx_factor
        return ret
1244933
def create_flavor(self, nova, name, ram, vcpus, disk, flavorid="auto",
                      ephemeral=0, swap=0, rxtx_factor=1.0, is_public=True):
        """"""
        try:
            nova.flavors.find(name=name)
        except (exceptions.NotFound, exceptions.NoUniqueMatch):
            self.log.debug('Creating flavor ({})'.format(name))
            nova.flavors.create(name, ram, vcpus, disk, flavorid,
                                ephemeral, swap, rxtx_factor, is_public)
114428
def list(cls, datacenter=None, flavor=None, match='', exact_match=False):
        
        if not datacenter:
            dc_ids = [dc['id'] for dc in Datacenter.filtered_list()]
            kmap = {}
            for dc_id in dc_ids:
                vals = cls.safe_call('hosting.disk.list_kernels', dc_id)
                for key in vals:
                    kmap.setdefault(key, []).extend(vals.get(key, []))
            # remove duplicates
            for key in kmap:
                kmap[key] = list(set(kmap[key]))
        else:
            dc_id = Datacenter.usable_id(datacenter)
            kmap = cls.safe_call('hosting.disk.list_kernels', dc_id)

        if match:
            for flav in kmap:
                if exact_match:
                    kmap[flav] = [x for x in kmap[flav] if match == x]
                else:
                    kmap[flav] = [x for x in kmap[flav] if match in x]
        if flavor:
            if flavor not in kmap:
                cls.error('flavor %s not supported here' % flavor)
            return dict([(flavor, kmap[flavor])])

        return kmap
793744
def check_environment(provider_conf):
    """"""
    session = get_session()
    image_id = check_glance(session, provider_conf.image)
    flavor_to_id, id_to_flavor = check_flavors(session)
    ext_net, network, subnet = check_network(
        session,
        provider_conf.configure_network,
        provider_conf.network,
        subnet=provider_conf.subnet,
        dns_nameservers=provider_conf.dns_nameservers,
        allocation_pool=provider_conf.allocation_pool)

    return {
        'session': session,
        'image_id': image_id,
        'flavor_to_id': flavor_to_id,
        'id_to_flavor': id_to_flavor,
        'ext_net': ext_net,
        'network': network,
        'subnet': subnet
    }
1299823
def flavor_list_paged(request, is_public=True, get_extras=False, marker=None,
                      paginate=False, sort_key="name", sort_dir="desc",
                      reversed_order=False):
    """"""
    has_more_data = False
    has_prev_data = False

    if paginate:
        if reversed_order:
            sort_dir = 'desc' if sort_dir == 'asc' else 'asc'
        page_size = utils.get_page_size(request)
        flavors = _nova.novaclient(request).flavors.list(is_public=is_public,
                                                         marker=marker,
                                                         limit=page_size + 1,
                                                         sort_key=sort_key,
                                                         sort_dir=sort_dir)
        flavors, has_more_data, has_prev_data = update_pagination(
            flavors, page_size, marker, reversed_order)
    else:
        flavors = _nova.novaclient(request).flavors.list(is_public=is_public)

    if get_extras:
        for flavor in flavors:
            flavor.extras = flavor_get_extras(request, flavor.id, True, flavor)

    return (flavors, has_more_data, has_prev_data)
1253133
def list_(runas=None):
    '''
    
    '''
    ret = []
    output = _rbenv_exec(['install', '--list'], runas=runas)
    if output:
        for line in output.splitlines():
            if line == 'Available versions:':
                continue
            ret.append(line.strip())
    return ret
70246
def _get_available_versions(self):
        '''
        
        '''
        solvables = self.zypper.nolock.xml.call('se', '-xv', self.name).getElementsByTagName('solvable')
        if not solvables:
            raise CommandExecutionError('No packages found matching \'{0}\''.format(self.name))

        return sorted(set([slv.getAttribute(self._attr_solvable_version)
                           for slv in solvables if slv.getAttribute(self._attr_solvable_version)]))
735061
def flavor_access_remove(flavor_id, project_id, profile=None, **kwargs):
    '''
    
    '''
    conn = _auth(profile, **kwargs)
    return conn.flavor_access_remove(flavor_id, project_id)
1263423
def _get_item(self, package, flavor):
        """"""

        for item in package['items']:
            if item['keyName'] == flavor:
                return item

        raise SoftLayer.SoftLayerError("Could not find valid item for: '%s'" % flavor)
613889
def flavor_get_extras(request, flavor_id, raw=False, flavor=None):
    """"""
    if flavor is None:
        flavor = _nova.novaclient(request).flavors.get(flavor_id)
    extras = flavor.get_keys()
    if raw:
        return extras
    return [FlavorExtraSpec(flavor_id, key, value) for
            key, value in extras.items()]
1265846
def per_from_id_except(s, flavors=chat_flavors+inline_flavors):
    
    return _wrap_none(lambda msg:
                          msg['from']['id']
                          if (flavors == 'all' or flavor(msg) in flavors) and msg['from']['id'] not in s
                          else None)
508325
def list_flavors(self, retrieve_all=True, **_params):
        """"""
        return self.list('flavors', self.flavors_path, retrieve_all,
                         **_params)
731848
def simple_detect(agent):
    
    result = detect(agent)
    os_list = []
    if 'flavor' in result:
        os_list.append(result['flavor']['name'])
    if 'dist' in result:
        os_list.append(result['dist']['name'])
    if 'os' in result:
        os_list.append(result['os']['name'])

    os = os_list and " ".join(os_list) or "Unknown OS"
    os_version = os_list and (result.get('flavor') and result['flavor'].get('version')) or \
        (result.get('dist') and result['dist'].get('version')) or (result.get('os') and result['os'].get('version')) or ""
    browser = 'browser' in result and result['browser'].get('name') or 'Unknown Browser'
    browser_version = 'browser' in result and result['browser'].get('version') or ""
    if browser_version:
        browser = " ".join((browser, browser_version))
    if os_version:
        os = " ".join((os, os_version))
    return os, browser
1148061
def list(self, search_opts=None):
        """"""
        query = base.get_query_string(search_opts)
        return self._list('/plugins%s' % query, 'plugins')
57887
def flavor_extra_delete(request, flavor_id, keys):
    """"""
    flavor = _nova.novaclient(request).flavors.get(flavor_id)
    return flavor.unset_keys(keys)
337216
def retrieve_list(self, parsed_args):
        """"""
        neutron_client = self.get_client()
        _extra_values = parse_args_to_dict(self.values_specs)
        _merge_args(self, parsed_args, _extra_values,
                    self.values_specs)
        search_opts = self.args2search_opts(parsed_args)
        search_opts.update(_extra_values)
        if self.pagination_support:
            page_size = parsed_args.page_size
            if page_size:
                search_opts.update({'limit': page_size})
        if self.sorting_support:
            keys = parsed_args.sort_key
            if keys:
                search_opts.update({'sort_key': keys})
            dirs = parsed_args.sort_dir
            len_diff = len(keys) - len(dirs)
            if len_diff > 0:
                dirs += ['asc'] * len_diff
            elif len_diff < 0:
                dirs = dirs[:len(keys)]
            if dirs:
                search_opts.update({'sort_dir': dirs})
        data = self.call_server(neutron_client, search_opts, parsed_args)
        collection = _get_resource_plural(self.resource, neutron_client)
        return data.get(collection, [])
1002425
def list_():
    '''
    
    '''

    result = __salt__['cmd.run']('tuned-adm list').splitlines()
    # Remove "Available profiles:"
    result.pop(0)
    # Remove "Current active profile:.*"
    result.pop()
    # Output can be : " - <profile name> - <description>" (v2.7.1)
    # or " - <profile name> " (v2.4.1)
    result = [i.split('- ')[1].strip() for i in result]
    return result