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


Python providers.setup_a_provider函数代码示例

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


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

示例1: test_db_restore

def test_db_restore(request, soft_assert):

    appl1, appl2 = get_appliances()

    def finalize():
        appl1.destroy()
        appl2.destroy()
    request.addfinalizer(finalize)

    appl1.ipapp.browser_steal = True
    with appl1.ipapp:
        # Manage infra,cloud providers and set some roles before taking a DB backup
        config.set_server_roles(automate=True)
        roles = config.get_server_roles()
        provider_crud = setup_a_provider('infra', 'virtualcenter', validate=True)
        provider_mgmt = provider_crud.get_mgmt_system()
        wait_for_a_provider()
        setup_a_provider('cloud', 'ec2', validate=True)
        cloud_provider.wait_for_a_provider()

        providers_appl1 = appl1.ipapp.managed_providers
        appl1.ipapp.backup_database()

    # Fetch v2_key and DB backup from the first appliance
    with appl1.ipapp.ssh_client as ssh:
        rand_filename = "/tmp/v2_key_{}".format(fauxfactory.gen_alphanumeric())
        ssh.get_file("/var/www/miq/vmdb/certs/v2_key", rand_filename)
        dump_filename = "/tmp/db_dump_{}".format(fauxfactory.gen_alphanumeric())
        ssh.get_file("/tmp/evm_db.backup", dump_filename)

    with appl2.ipapp.ssh_client as ssh:
        ssh.put_file(rand_filename, "/var/www/miq/vmdb/certs/v2_key")
        ssh.put_file(dump_filename, "/tmp/evm_db.backup")

    appl2.ipapp.browser_steal = True
    with appl2.ipapp:
        # Restore DB on the second appliance
        appl2.ipapp.restore_database()
        appl2.ipapp.wait_for_web_ui()
        wait_for_a_provider()
        cloud_provider.wait_for_a_provider()

        # Assert providers on the second appliance
        providers_appl2 = appl2.ipapp.managed_providers
        assert set(providers_appl2).issubset(providers_appl1),\
            'Restored DB is missing some providers'

        # Verify that existing provider can detect new VMs on the second appliance
        vm = provision_vm(request, provider_crud, provider_mgmt)
        soft_assert(vm.find_quadicon().state == 'currentstate-on')
        soft_assert(vm.provider_crud.get_mgmt_system().is_vm_running(vm.name),
            "vm running")

        # Assert server roles on the second appliance
        for role, is_enabled in config.get_server_roles(db=False).iteritems():
            if is_enabled:
                assert roles[role], "Role '%s' is selected but should not be" % role
            else:
                assert not roles[role], "Role '%s' is not selected but should be" % role
开发者ID:richardfontana,项目名称:cfme_tests,代码行数:59,代码来源:test_db_restore.py

示例2: providers

def providers():
    """Ensure the infra providers are set up and get list of hosts"""
    try:
        setup_a_provider(prov_class="infra")
    except Exception:
        pytest.skip("It's not possible to set up any providers, therefore skipping")
    pytest.sel.force_navigate("infrastructure_providers")
    search.ensure_no_filter_applied()
开发者ID:FilipB,项目名称:cfme_tests,代码行数:8,代码来源:test_advanced_search_providers.py

示例3: vms

def vms():
    """Ensure the infra providers are set up and get list of vms"""
    try:
        setup_a_provider(prov_class="infra", required_keys=["large"])
    except Exception:
        pytest.skip("It's not possible to set up any providers, therefore skipping")
    navigate_to(Vm, 'VMsOnly')
    search.ensure_no_filter_applied()
    return virtual_machines.get_all_vms()
开发者ID:ManageIQ,项目名称:integration_tests,代码行数:9,代码来源:test_advanced_search_vms.py

示例4: vms

def vms():
    """Ensure the infra providers are set up and get list of vms"""
    try:
        setup_a_provider(prov_type="infra", required_keys="large")
    except Exception:
        pytest.skip("It's not possible to set up any providers, therefore skipping")
    sel.force_navigate("infra_vms")
    search.ensure_no_filter_applied()
    return virtual_machines.get_all_vms()
开发者ID:pombredanne,项目名称:cfme_tests,代码行数:9,代码来源:test_advanced_search_vms.py

示例5: hosts

def hosts():
    """Ensure the infra providers are set up and get list of hosts"""
    try:
        setup_a_provider(prov_class="infra")
    except Exception:
        pytest.skip("It's not possible to set up any providers, therefore skipping")
    navigate_to(Host, 'All')
    search.ensure_no_filter_applied()
    return host.get_all_hosts()
开发者ID:RonnyPfannschmidt,项目名称:cfme_tests,代码行数:9,代码来源:test_advanced_search_host.py

示例6: existing_vm

def existing_vm(request):
    """ Fixture will be using for set\unset retirement date for existing vm instead of
    creation a new one
    """
    list_of_existing_providers = providers.existing_providers()
    if list_of_existing_providers:
        test_provider = providers.get_crud(list_of_existing_providers[0])
    else:
        test_provider = providers.setup_a_provider()
    all_vms = test_provider.mgmt.list_vm()
    need_to_create_vm = True
    for virtual_machine in all_vms:
        if test_provider.mgmt.is_vm_running(virtual_machine):
            need_vm = VM.factory(virtual_machine, test_provider)
            need_to_create_vm = False
            break
    if need_to_create_vm:
        machine_name = 'test_retire_prov_{}'.format(fauxfactory.gen_alpha(length=8).lower())
        need_vm = VM.factory(machine_name, test_provider)
        need_vm.create_on_provider(find_in_cfme=True, allow_skip="default")

    @request.addfinalizer
    def _delete_vm():
        if need_to_create_vm:
            test_provider.mgmt.delete_vm(need_vm.name)
    return need_vm
开发者ID:FilipB,项目名称:cfme_tests,代码行数:26,代码来源:test_retirement.py

示例7: a_provider

def a_provider():
    try:
        pf = ProviderFilter(classes=[InfraProvider], required_fields=[
            ['provisioning', 'template'],
            ['provisioning', 'host'],
            ['provisioning', 'datastore'],
            ['provisioning', 'vlan'],
            ['provisioning', 'catalog_item_type']])
        return setup_a_provider(filters=[pf])
    except Exception:
        pytest.skip("It's not possible to set up any providers, therefore skipping")
开发者ID:rananda,项目名称:cfme_tests,代码行数:11,代码来源:test_rest_services.py

示例8: setup_first_provider

def setup_first_provider():
    setup_a_provider(validate=True, check_existing=True)
开发者ID:MattLombana,项目名称:cfme_tests,代码行数:2,代码来源:test_ipa_external.py

示例9: any_provider_session

def any_provider_session():
    providers.clear_providers()  # To make it clean
    providers.setup_a_provider(validate=True, check_existing=True)
开发者ID:pombredanne,项目名称:cfme_tests,代码行数:3,代码来源:provider.py

示例10: single_provider

def single_provider():
    """Ensure the infra provider is setup"""
    try:
        return setup_a_provider(prov_class="infra")
    except Exception as ex:
        pytest.skip("Exception while setting up providers, therefore skipping: {}".format(ex))
开发者ID:RonnyPfannschmidt,项目名称:cfme_tests,代码行数:6,代码来源:test_advanced_search_providers.py

示例11: setup_a_provider

def setup_a_provider():
    return providers.setup_a_provider(prov_class="cloud", validate=True, check_existing=True)
开发者ID:RonnyPfannschmidt,项目名称:cfme_tests,代码行数:2,代码来源:test_providers.py

示例12: provider

def provider():
    return setup_a_provider(prov_class="infra", prov_type="virtualcenter")
开发者ID:pombredanne,项目名称:cfme_tests,代码行数:2,代码来源:test_chargeback_assignments.py

示例13: setup_single_provider

def setup_single_provider():
    setup_a_provider()
开发者ID:pombredanne,项目名称:cfme_tests,代码行数:2,代码来源:test_namespace.py

示例14: setup_first_provider

def setup_first_provider():
    providers.setup_a_provider(prov_class="infra", validate=True, check_existing=True)
    providers.setup_a_provider(prov_class="cloud", validate=True, check_existing=True)
开发者ID:prachiyadav,项目名称:cfme_tests,代码行数:3,代码来源:test_tag_objects.py

示例15: setup_infra_provider

def setup_infra_provider():
    return setup_a_provider(prov_class="infra", validate=True, check_existing=True,
        required_keys=['ownership_vm'])
开发者ID:pombredanne,项目名称:cfme_tests,代码行数:3,代码来源:test_vm_ownership.py


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