当前位置: 首页>>代码示例>>Python>>正文


Python providers.list_providers函数代码示例

本文整理汇总了Python中utils.providers.list_providers函数的典型用法代码示例。如果您正苦于以下问题:Python list_providers函数的具体用法?Python list_providers怎么用?Python list_providers使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了list_providers函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setup_one_or_skip

def setup_one_or_skip(request, filters=None, use_global_filters=True):
    """ Sets up one of matching providers or skips the test

    Args:
        filters: List of :py:class:`ProviderFilter` or None
        request: Needed for logging a potential skip correctly in artifactor
        use_global_filters: Will apply global filters as well if `True`, will not otherwise
    """

    filters = filters or []
    providers = list_providers(filters=filters, use_global_filters=use_global_filters)

    # All providers filtered out?
    if not providers:
        global_providers = list_providers(filters=None, use_global_filters=use_global_filters)
        if not global_providers:
            # This can also mean that there simply are no providers in the yamls!
            pytest.skip("No provider matching global filters found")
        else:
            pytest.skip("No provider matching test-specific filters found")

    # Are all providers marked as problematic?
    if _problematic_providers.issuperset(providers):
        skip_msg = "All providers marked as problematic: {}".format([p.key for p in providers])
        _artifactor_skip_providers(request, providers, skip_msg)

    # If there is a provider already set up matching the user's requirements, reuse it
    for provider in providers:
        if provider.exists:
            return provider

    # If we have more than one provider, we create two separate groups of providers, preferred
    # and not preferred, that we shuffle separately and then join together
    if len(providers) > 1:
        only_preferred_filter = ProviderFilter(required_fields=[("do_not_prefer", True)],
                                               inverted=True)
        preferred_providers = list_providers(
            filters=filters + [only_preferred_filter], use_global_filters=use_global_filters)
        not_preferred_providers = [p for p in providers if p not in preferred_providers]
        random.shuffle(preferred_providers)
        random.shuffle(not_preferred_providers)
        providers = preferred_providers + not_preferred_providers

    # Try to set up one of matching providers
    non_existing = [prov for prov in providers if not prov.exists]
    for provider in non_existing:
        if _setup_provider_verbose(request, provider):
            return provider

    skip_msg = "Failed to set up any matching providers: {}", [p.key for p in providers]
    _artifactor_skip_providers(request, non_existing, skip_msg)
开发者ID:dajohnso,项目名称:cfme_tests,代码行数:51,代码来源:provider.py

示例2: run

def run(**kwargs):

    try:
        thread_queue = []
        for provider in list_providers("virtualcenter"):

            mgmt_sys = cfme_data['management_systems'][provider]
            creds = credentials[mgmt_sys['credentials']]

            hostname = mgmt_sys['hostname']
            username = creds['username']
            password = creds['password']
            default_name = credentials['host_default']['username']
            default_password = credentials['host_default']['password']
            host_ip = mgmt_sys['ipaddress']
            client = VMWareSystem(hostname, username, password)

            if not net.is_pingable(host_ip):
                continue
            thread = Thread(target=upload_template,
                            args=(client, hostname, username, password, provider,
                                  kwargs.get('image_url'), kwargs.get('template_name'),
                                  default_name, default_password))
            thread.daemon = True
            thread_queue.append(thread)
            thread.start()

        for thread in thread_queue:
            thread.join()
    except Exception as e:
        print(e)
        return False
开发者ID:prachiyadav,项目名称:cfme_tests,代码行数:32,代码来源:template_upload_vsphere.py

示例3: run

def run(**kwargs):

    thread_queue = []
    for provider in list_providers("openstack"):
        mgmt_sys = cfme_data['management_systems'][provider]
        rhos_credentials = credentials[mgmt_sys['credentials']]
        default_host_creds = credentials['host_default']

        username = rhos_credentials['username']
        password = rhos_credentials['password']
        auth_url = mgmt_sys['auth_url']
        rhosip = mgmt_sys['ipaddress']
        sshname = default_host_creds['username']
        sshpass = default_host_creds['password']
        if not net.is_pingable(rhosip):
            continue
        if not net.net_check(ports.SSH, rhosip):
            print("SSH connection to {}:{} failed, port unavailable".format(
                provider, ports.SSH))
            continue
        thread = Thread(target=upload_template,
                        args=(rhosip, sshname, sshpass, username, password, auth_url, provider,
                              kwargs.get('image_url'), kwargs.get('template_name')))
        thread.daemon = True
        thread_queue.append(thread)
        thread.start()

    for thread in thread_queue:
        thread.join()
开发者ID:prachiyadav,项目名称:cfme_tests,代码行数:29,代码来源:template_upload_rhos.py

示例4: test_containers_overview_data_integrity

def test_containers_overview_data_integrity():
    """Test data integrity of status boxes in containers dashboard.
    Steps:
        * Go to Containers / Overview
        * All cells should contain the correct relevant information
            # of nodes
            # of providers
            # ...
    """
    navigate_to(ContainersOverview, 'All')
    # We should wait ~2 seconds for the StatusBox population
    # (until we find a better solution)
    time.sleep(2)
    statusbox_values = {data_set.object: int(StatusBox(data_set.name).value())
                        for data_set in DATA_SETS}
    api_values = get_api_object_counts(
        map(lambda name: ContainersProvider(name, key=name),
            list_providers('openshift'))
    )
    results = {}
    for cls in DATA_SETS:
        results[cls.object] = api_values[cls.object] == statusbox_values[cls.object]
    if not all(results.values()):
        pytest.fail('There is a mismatch between API and UI values:\n{}'.format(
                    '\n'.join(['{}: {} (API) != {} (UI)'.format(
                        obj.__name__, api_values[obj], statusbox_values[obj])
                        for obj, is_pass in results.items() if not is_pass])))
开发者ID:ManageIQ,项目名称:integration_tests,代码行数:27,代码来源:test_containers_overview_data_integrity.py

示例5: run

def run(**kwargs):
    """Calls all the functions needed to upload new template to RHEVM.
       This is called either by template_upload_all script, or by main function.

    Args:
        **kwargs: Kwargs generated from cfme_data['template_upload']['template_upload_rhevm'].
    """
    thread_queue = []
    valid_providers = []

    providers = list_providers("rhevm")
    if kwargs['provider_data']:
        mgmt_sys = providers = kwargs['provider_data']['management_systems']
    for provider in providers:
        if kwargs['provider_data']:
            if mgmt_sys[provider]['type'] != 'rhevm':
                continue
            sshname = mgmt_sys[provider]['sshname']
            sshpass = mgmt_sys[provider]['sshpass']
            rhevip = mgmt_sys[provider]['ipaddress']
        else:
            mgmt_sys = cfme_data['management_systems']
            ssh_rhevm_creds = mgmt_sys[provider]['ssh_creds']
            sshname = credentials[ssh_rhevm_creds]['username']
            sshpass = credentials[ssh_rhevm_creds]['password']
            rhevip = mgmt_sys[provider]['ipaddress']
        print("RHEVM:{} verifying provider's state before template upload".format(provider))
        if not net.is_pingable(rhevip):
            continue
        elif not is_ovirt_engine_running(rhevip, sshname, sshpass):
            print('RHEVM:{} ovirt-engine service not running..'.format(provider))
            continue
        valid_providers.append(provider)

    for provider in valid_providers:
        if kwargs['provider_data']:
            sshname = mgmt_sys[provider]['sshname']
            sshpass = mgmt_sys[provider]['sshpass']
            username = mgmt_sys[provider]['username']
            password = mgmt_sys[provider]['password']
        else:
            ssh_rhevm_creds = mgmt_sys[provider]['ssh_creds']
            sshname = credentials[ssh_rhevm_creds]['username']
            sshpass = credentials[ssh_rhevm_creds]['password']
            rhevm_credentials = mgmt_sys[provider]['credentials']
            username = credentials[rhevm_credentials]['username']
            password = credentials[rhevm_credentials]['password']

        rhevip = mgmt_sys[provider]['ipaddress']
        thread = Thread(target=upload_template,
                        args=(rhevip, sshname, sshpass, username, password, provider,
                              kwargs.get('image_url'), kwargs.get('template_name'),
                              kwargs['provider_data']))
        thread.daemon = True
        thread_queue.append(thread)
        thread.start()

    for thread in thread_queue:
        thread.join()
开发者ID:pavelzag,项目名称:cfme_tests,代码行数:59,代码来源:template_upload_rhevm.py

示例6: servers_in_mgmt

 def servers_in_mgmt(cls, provider=None, server_group=None):
     if provider is None:
         servers = []
         for _provider in list_providers('hawkular'):
             servers.extend(cls._servers_in_mgmt(get_crud(_provider), server_group))
         return servers
     else:
         return cls._servers_in_mgmt(provider, server_group)
开发者ID:RonnyPfannschmidt,项目名称:cfme_tests,代码行数:8,代码来源:server.py

示例7: datasources_in_mgmt

 def datasources_in_mgmt(cls, provider=None, server=None):
     if provider is None:
         datasources = []
         for _provider in list_providers('hawkular'):
             datasources.extend(cls._datasources_in_mgmt(get_crud(_provider), server))
         return datasources
     else:
         return cls._datasources_in_mgmt(provider, server)
开发者ID:jteehan,项目名称:cfme_tests,代码行数:8,代码来源:datasource.py

示例8: deployments_in_mgmt

 def deployments_in_mgmt(cls, provider=None, server=None):
     if provider is None:
         deployments = []
         for _provider in list_providers('hawkular'):
             deployments.extend(cls._deployments_in_mgmt(get_crud(_provider), server))
         return deployments
     else:
         return cls._deployments_in_mgmt(provider, server)
开发者ID:FilipB,项目名称:cfme_tests,代码行数:8,代码来源:deployment.py

示例9: templates_uploaded_on_providers

def templates_uploaded_on_providers(api, stream, template):
    if get_untested_templates(api, stream, template):
        print('report will not be generated, proceed with the next untested provider')
        sys.exit()
    for temp in api.template.get(
            limit=1, tested=False, group__name=stream).get('objects', []):
        if 'template_rhevm' in images_uploaded(stream):
            if not provider_in_the_list(list_providers('rhevm'), temp['providers']):
                return False
        if 'template_rhos' in images_uploaded(stream):
            if not provider_in_the_list(list_providers('openstack'), temp['providers']):
                return False
        if 'template_vsphere' in images_uploaded(stream):
            if not provider_in_the_list(list_providers('virtualcenter'), temp['providers']):
                return False
        if 'template_scvmm' in images_uploaded(stream):
            if not provider_in_the_list(list_providers('scvmm'), temp['providers']):
                return False
    return True
开发者ID:RonnyPfannschmidt,项目名称:cfme_tests,代码行数:19,代码来源:latest_template_tester_report.py

示例10: ec2cleanup

def ec2cleanup(texts, max_hours, exclude_instances, exclude_volumes, exclude_eips, output):
    for provider in list_providers('ec2'):
        ec2provider = get_mgmt(provider)
        logger.info("\n" + provider + ":\n")
        logger.info("Deleted instances:")
        delete_old_instances(texts=texts, ec2provider=ec2provider, provider_key=provider,
                             date=datetime.datetime.now(), maxhours=max_hours,
                             excluded_instances=exclude_instances, output=output)
        time.sleep(120)
        logger.info("\nReleased addresses:")
        delete_disassociated_addresses(ec2provider=ec2provider, excluded_eips=exclude_eips)
        logger.info("\nDeleted volumes:")
        delete_unattached_volumes(ec2provider=ec2provider, excluded_volumes=exclude_volumes)
开发者ID:kzvyahin,项目名称:cfme_tests,代码行数:13,代码来源:ec2cleanup.py

示例11: ec2cleanup

def ec2cleanup(max_hours, exclude_instances, exclude_volumes, exclude_eips):
    for provider in list_providers("ec2"):
        ec2provider = get_mgmt(provider)
        logger.info("\n" + provider + ":\n")
        logger.info("Deleted instances:")
        delete_old_instances(
            ec2provider=ec2provider, date=datetime.now(), maxhours=max_hours, excluded_instances=exclude_instances
        )
        sleep(120)
        logger.info("\nReleased addresses:")
        delete_disassociated_addresses(ec2provider=ec2provider, excluded_ips=exclude_eips)
        logger.info("\nDeleted volumes:")
        delete_unattached_volumes(ec2provider=ec2provider, excluded_volumes=exclude_volumes)
开发者ID:RonnyPfannschmidt,项目名称:cfme_tests,代码行数:13,代码来源:ec2cleanup.py

示例12: main

def main(*providers):
    for provider_key in list_providers('openstack'):
        print('Checking {}'.format(provider_key))
        api = get_mgmt(provider_key).api
        try:
            fips = api.floating_ips.findall(fixed_ip=None)
        except Exception:
            print('Unable to get fips for {}:'.format(provider_key))
            print(format_exc().splitlines()[-1])
            continue

        for fip in fips:
            print('Deleting {} on {}'.format(fip.ip, provider_key))
            fip.delete()
            print('{} deleted'.format(fip.ip))
开发者ID:FilipB,项目名称:cfme_tests,代码行数:15,代码来源:cleanup_openstack_fips.py

示例13: run

def run(**kwargs):
    """Calls all the functions needed to import new template to EC2.
        This is called either by template_upload_all script, or by main function.

     Args:
         **kwargs: Kwargs are passed by template_upload_all.
     """
    mgmt_sys = cfme_data['management_systems']
    for provider in list_providers('ec2'):
        ssh_rhevm_creds = mgmt_sys[provider]['credentials']
        username = credentials[ssh_rhevm_creds]['username']
        password = credentials[ssh_rhevm_creds]['password']
        upload_bucket_name = mgmt_sys[provider]['upload_bucket_name']
        upload_template(provider, username, password, upload_bucket_name, kwargs.get(
            'image_url'), kwargs.get('template_name'))
开发者ID:RonnyPfannschmidt,项目名称:cfme_tests,代码行数:15,代码来源:template_upload_ec2.py

示例14: pytest_configure

def pytest_configure(config):
    """ Filters the list of providers as part of pytest configuration

    Note:
        Additional filter is added to the global_filters dict of active filters here.
    """

    cmd_filter = config.getvalueorskip('use_provider')
    if not cmd_filter:
        cmd_filter = ["default"]

    new_filter = ProviderFilter(keys=cmd_filter, required_tags=cmd_filter, conjunctive=False)
    global_filters['use_provider'] = new_filter

    logger.debug('Filtering providers with {}, leaves {}'.format(
        cmd_filter, [prov.key for prov in list_providers()]))
开发者ID:dajohnso,项目名称:cfme_tests,代码行数:16,代码来源:prov_filter.py

示例15: clear_providers_by_class

    def clear_providers_by_class(prov_class, validate=True):
        """ Removes all providers that are an instance of given class or one of it's subclasses
        """
        from utils.providers import ProviderFilter, list_providers
        pf = ProviderFilter(classes=[prov_class])
        provs = list_providers(filters=[pf], use_global_filters=False)

        # First, delete all
        deleted_provs = []
        for prov in provs:
            existed = prov.delete_if_exists(cancel=False)
            if existed:
                deleted_provs.append(prov)
        # Then, check that all were deleted
        if validate:
            for prov in deleted_provs:
                prov.wait_for_delete()
开发者ID:rananda,项目名称:cfme_tests,代码行数:17,代码来源:provider.py


注:本文中的utils.providers.list_providers函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。