• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python wait_for.wait_for函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: _reload

    def _reload(self):
        self._legends = []
        self._elements = []
        self._lines = []
        self.search_box = TopologySearchBox()
        self.display_names = TopologyDisplayNames()
        # load elements
        # we have to wait few seconds, initial few seconds elements are moving
        if len(sel.elements(self.ELEMENTS)) > 0:
            self._el_ref = TopologyElement(o=self, element=sel.elements(self.ELEMENTS)[-1])
            wait_for(lambda: self._is_el_movement_stopped(), delay=2, num_sec=30)

            for element in sel.elements(self.ELEMENTS):
                self._elements.append(TopologyElement(o=self, element=element))
            # load lines
            for line in sel.elements(self.LINES):
                self._lines.append(TopologyLine(element=line))
        # load legends
        # remove old legends
        for legend_id in self._legends:
            try:
                delattr(self, legend_id)
            except AttributeError:
                pass
        # load available legends
        for legend in sel.elements(self.LEGENDS):
            legend_text = sel.text_sane(legend.find_element_by_tag_name('label'))
            legend_id = attributize_string(legend_text.strip())
            legend_object = TopologyLegend(name=legend_text, element=legend)
            setattr(self, legend_id, legend_object)
            self._legends.append(legend_id)
开发者ID:FilipB,项目名称:cfme_tests,代码行数:31,代码来源:topology.py


示例2: test_appliance_console_restore_pg_basebackup_ansible

def test_appliance_console_restore_pg_basebackup_ansible(get_appliance_with_ansible):
    appl1 = get_appliance_with_ansible
    # Restore DB on the second appliance
    appl1.evmserverd.stop()
    appl1.db.restart_db_service()
    command_set = ('ap', '', '4', '1', '/tmp/backup/base.tar.gz', TimedCommand('y', 60), '')
    appl1.appliance_console.run_commands(command_set)
    manager.quit()
    appl1.start_evm_service()
    appl1.wait_for_web_ui()
    appl1.reboot()
    appl1.start_evm_service()
    appl1.wait_for_web_ui()
    appl1.ssh_client.run_command(
        'curl -kL https://localhost/ansibleapi | grep "Ansible Tower REST API"')
    repositories = appl1.collections.ansible_repositories
    repository = repositories.create('example', REPOSITORIES[0], description='example')
    view = navigate_to(repository, "Details")
    refresh = view.toolbar.refresh.click
    wait_for(
        lambda: view.entities.summary("Properties").get_text_of("Status") == "successful",
        timeout=60,
        fail_func=refresh,
        message="Check if playbook repo added"
    )
开发者ID:lcouzens,项目名称:cfme_tests,代码行数:25,代码来源:test_appliance_console_db_restore.py


示例3: delete_vm

    def delete_vm(self, vm_name):
        self.wait_vm_steady(vm_name)
        if not self.is_vm_stopped(vm_name):
            self.stop_vm(vm_name)
        self.logger.debug(' Deleting RHEV VM %s' % vm_name)

        def _do_delete():
            """Returns True if you have to retry"""
            if not self.does_vm_exist(vm_name):
                return False
            try:
                vm = self._get_vm(vm_name)
                vm.delete()
            except RequestError as e:
                # Handle some states that can occur and can be circumvented
                if e.status == 409 and "Related operation" in e.detail:
                    self.logger.info("Waiting for RHEV: {}:{} ({})".format(
                        e.status, e.reason, e.detail))
                    return True
                else:
                    raise  # Raise other so we can see them and eventually add them into handling
                # TODO: handle 400 - but I haven't seen the error message, it was empty.
            else:
                return False

        wait_for(_do_delete, fail_condition=True, num_sec=600, delay=15, message="execute delete")

        wait_for(
            lambda: self.does_vm_exist(vm_name),
            fail_condition=True,
            message="wait for RHEV VM %s deleted" % vm_name,
            num_sec=300
        )
        return True
开发者ID:jteehan,项目名称:mgmtsystem,代码行数:34,代码来源:rhevm.py


示例4: test_appliance_console_dedicated_db

def test_appliance_console_dedicated_db(unconfigured_appliance, app_creds):
    """ Commands:
    1. 'ap' launch appliance_console,
    2. RETURN clear info screen,
    3. '7' setup db,
    4. '1' Creates v2_key,
    5. '1' selects internal db,
    6. '2' use /dev/vdb partition,
    7. 'y' create dedicated db,
    8. 'pwd' db password,
    9. 'pwd' confirm db password + wait 360 secs
    10. RETURN finish.

    Polarion:
        assignee: mnadeem
        caseimportance: high
        casecomponent: Appliance
        initialEstimate: 1/3h
        testtype: structural
    """

    pwd = app_creds['password']
    command_set = ('ap', RETURN, '7', '1', '1', '2', 'y', pwd, TimedCommand(pwd, 360), RETURN)
    unconfigured_appliance.appliance_console.run_commands(command_set)
    wait_for(lambda: unconfigured_appliance.db.is_dedicated_active)
开发者ID:apagac,项目名称:cfme_tests,代码行数:25,代码来源:test_appliance_console.py


示例5: test_sdn_nsg_firewall_rules

def test_sdn_nsg_firewall_rules(provider, appliance, secgroup_with_rule):
    """ Pulls the list of firewall ports from Provider API and from appliance. Compare the 2
    results. If same, then test is successful.

    Metadata:
        test_flag: sdn, inventory

    Polarion:
        assignee: mmojzis
        initialEstimate: 1/4h
    """

    # Navigate to network provider.
    prov_collection = appliance.collections.network_providers.filter({'provider': provider})
    network_provider = prov_collection.all()[0]
    network_provider.refresh_provider_relationships()
    wait_for(network_provider.is_refreshed, func_kwargs=dict(refresh_delta=10), timeout=600)
    view = navigate_to(network_provider, 'Details')
    parent_name = view.entities.relationships.get_text_of("Parent Cloud Provider")
    assert parent_name == provider.name

    secgrp_collection = appliance.collections.network_security_groups
    secgroup = [i for i in secgrp_collection.all() if i.name == secgroup_with_rule][0]
    view = navigate_to(secgroup, 'Details')

    if appliance.version < '5.10':
        # The table has one header row. The first non-header row has column
        # names.
        assert 'Port' == view.entities.firewall_rules[1][3].text
        assert '22' == view.entities.firewall_rules[2][3].text
    else:
        # The table has two header rows. We cannot access the second one with
        # widgetastic. So let's hope the column of index 3 is the Port Range
        # column.
        assert '22' == view.entities.firewall_rules[1][3].text
开发者ID:mkoura,项目名称:cfme_tests,代码行数:35,代码来源:test_sdn_inventory_collection.py


示例6: test_appliance_console_dhcp

def test_appliance_console_dhcp(unconfigured_appliance, soft_assert):
    """ Commands:
    1. 'ap' launches appliance_console,
    2. RETURN clears info screen,
    3. '1' configure network,
    4. '1' configure DHCP,
    5. 'y' confirm IPv4 configuration,
    6. 'y' IPv6 configuration.

    Polarion:
        assignee: mnadeem
        casecomponent: Appliance
        caseimportance: critical
        initialEstimate: 1/6h
    """
    command_set = ('ap', RETURN, '1', '1', 'y', TimedCommand('y', 90), RETURN, RETURN)
    unconfigured_appliance.appliance_console.run_commands(command_set)

    def appliance_is_connective():
        unconfigured_appliance.ssh_client.run_command("true")
    wait_for(appliance_is_connective, handle_exception=True, delay=1, timeout=30)

    soft_assert(unconfigured_appliance.ssh_client.run_command(
        r"ip a show dev eth0 | grep 'inet\s.*dynamic'").success)
    soft_assert(unconfigured_appliance.ssh_client.run_command(
        r"ip a show dev eth0 | grep 'inet6\s.*dynamic'").success)
开发者ID:apagac,项目名称:cfme_tests,代码行数:26,代码来源:test_appliance_console.py


示例7: test_appliance_console_ipa

def test_appliance_console_ipa(ipa_crud, configured_appliance):
    """ Commands:
    1. 'ap' launches appliance_console,
    2. RETURN clears info screen,
    3. '12' setup IPA, + wait 40 secs,
    4. RETURN finish.

    Polarion:
        assignee: mnadeem
        caseimportance: high
        casecomponent: Auth
        initialEstimate: 1/4h
    """

    command_set = ('ap', RETURN, '12', ipa_crud.host1, ipa_crud.ipadomain, ipa_crud.iparealm,
                   ipa_crud.ipaprincipal, ipa_crud.bind_password, TimedCommand('y', 60),
                   RETURN, RETURN)
    configured_appliance.appliance_console.run_commands(command_set, timeout=20)
    configured_appliance.sssd.wait_for_running()
    assert configured_appliance.ssh_client.run_command("cat /etc/ipa/default.conf |"
                                                       "grep 'enable_ra = True'")

    # Unconfigure to cleanup
    # When setup_ipa option selected, will prompt to unconfigure, then to proceed with new config
    command_set = ('ap', RETURN, '12', TimedCommand('y', 40), TimedCommand('n', 5), RETURN, RETURN)
    configured_appliance.appliance_console.run_commands(command_set)
    wait_for(lambda: not configured_appliance.sssd.running)
开发者ID:apagac,项目名称:cfme_tests,代码行数:27,代码来源:test_appliance_console.py


示例8: test_appliance_console_static_ipv6

def test_appliance_console_static_ipv6(unconfigured_appliance, soft_assert):
    """ Commands:
    1. 'ap' launches appliance_console,
    2. RETURN clears info screen,
    3. '1' configure network,
    4. '3' configure static IPv6,
    5. '1::1' set IPv4 addr,
    6. RETURN set deafault prefix length,
    7. '1::f' set IPv6 gateway,
    8. RETURN confirm default primary DNS,
    9. RETURN confirm default secondary DNS,
    10. RETURN confirm default search order,
    11. 'y' apply static configuration.

    Polarion:
        assignee: mnadeem
        caseimportance: high
        casecomponent: Appliance
        initialEstimate: 1/4h
    """
    command_set = ('ap', RETURN, '1', '3', '1::1', RETURN, '1::f', RETURN, RETURN, RETURN, 'y', '')
    unconfigured_appliance.appliance_console.run_commands(command_set, timeout=30)

    def appliance_is_connective():
        unconfigured_appliance.ssh_client.run_command("true")
    wait_for(appliance_is_connective, handle_exception=True, delay=1, timeout=30)

    soft_assert(unconfigured_appliance.ssh_client.run_command(
        "ip -6 a show dev eth0 | grep 'inet6 1::1.*scope global'"))
    soft_assert(unconfigured_appliance.ssh_client.run_command(
        "ip -6 r show dev eth0 | grep 'default via 1::f'"))
开发者ID:apagac,项目名称:cfme_tests,代码行数:31,代码来源:test_appliance_console.py


示例9: test_appliance_console_static_ipv4

def test_appliance_console_static_ipv4(unconfigured_appliance, soft_assert):
    """ Commands:
    1. 'ap' launches appliance_console,
    2. RETURN clears info screen,
    3. '1' configure network,
    4. '2' configure static IPv4,
    5. RETURN confirm default IPv4 addr,
    6. RETURN confirm default netmask,
    7. RETURN confirm default gateway,
    8. RETURN confirm default primary DNS,
    9. RETURN confirm default secondary DNS,
    10. RETURN confirm default search order,
    11. 'y' apply static configuration.

    Polarion:
        assignee: mnadeem
        casecomponent: Appliance
        caseimportance: critical
        initialEstimate: 1/6h
    """
    command_set = ('ap', RETURN, '1', '2', RETURN, RETURN, RETURN, RETURN, RETURN, RETURN, 'y')
    unconfigured_appliance.appliance_console.run_commands(command_set)

    def appliance_is_connective():
        unconfigured_appliance.ssh_client.run_command("true")
    wait_for(appliance_is_connective, handle_exception=True, delay=1, timeout=30)

    soft_assert(unconfigured_appliance.ssh_client.run_command(
        "ip -4 a show dev eth0 | grep 'inet .*scope global eth0'"))
    soft_assert(unconfigured_appliance.ssh_client.run_command(
        "ip -4 r show dev eth0 | grep 'default via'"))
开发者ID:apagac,项目名称:cfme_tests,代码行数:31,代码来源:test_appliance_console.py


示例10: restart_vm

 def restart_vm(self, instance_name):
     self.logger.info("Restarting Google Cloud instance {}".format(instance_name))
     operation = self._instances.reset(
         project=self._project, zone=self._zone, instance=instance_name).execute()
     wait_for(lambda: self._nested_operation_wait(operation['name']),
         message="Restart {}".format(instance_name))
     return True
开发者ID:jteehan,项目名称:mgmtsystem,代码行数:7,代码来源:google.py


示例11: test_appliance_console_set_hostname

def test_appliance_console_set_hostname(configured_appliance):
    """ Commands:
    1. 'ap' launch appliance_console,
    2. RETURN clear info screen,
    3. '1' loads network settings,
    4. '5' gives access to set hostname,
    5. 'hostname' sets new hostname.

    Polarion:
        assignee: mnadeem
        caseimportance: high
        casecomponent: Appliance
        initialEstimate: 1/6h
    """

    hostname = 'test.example.com'
    command_set = ('ap', RETURN, '1', '5', hostname, RETURN, RETURN)
    configured_appliance.appliance_console.run_commands(command_set, timeout=30)

    def is_hostname_set(appliance):
        return appliance.ssh_client.run_command("hostname -f | grep {hostname}"
                                                .format(hostname=hostname)).success
    wait_for(is_hostname_set, func_args=[configured_appliance])
    result = configured_appliance.ssh_client.run_command("hostname -f")
    assert result.success
    assert result.output.strip() == hostname
开发者ID:apagac,项目名称:cfme_tests,代码行数:26,代码来源:test_appliance_console.py


示例12: client

def client():
    url = 'http://localhost:8088/v1-catalog/schemas'
    templates = cattle.from_env(url=url).list_template(catalogId='qa-catalog')
    wait_for(
        lambda: len(templates) > 0
    )
    return cattle.from_env(url=url)
开发者ID:LLParse,项目名称:rancher-catalog-service,代码行数:7,代码来源:test_api.py


示例13: pause_vm

    def pause_vm(self, instance_name):
        self.logger.info(" Pausing OpenStack instance %s" % instance_name)
        if self.is_vm_paused(instance_name):
            return True

        instance = self._find_instance_by_name(instance_name)
        instance.pause()
        wait_for(lambda: self.is_vm_paused(instance_name), message="pause %s" % instance_name)
开发者ID:nachandr,项目名称:mgmtsystem,代码行数:8,代码来源:openstack.py


示例14: test_appliance_console_cli_datetime

def test_appliance_console_cli_datetime(temp_appliance_preconfig_funcscope):
    """Grab fresh appliance and set time and date through appliance_console_cli and check result"""
    app = temp_appliance_preconfig_funcscope
    app.ssh_client.run_command("appliance_console_cli --datetime 2020-10-20T09:59:00")

    def date_changed():
        return app.ssh_client.run_command("date +%F-%T | grep 2020-10-20-10:00").success
    wait_for(date_changed)
开发者ID:LandoCalrizzian,项目名称:cfme_tests,代码行数:8,代码来源:test_appliance_cli.py


示例15: suspend_vm

    def suspend_vm(self, instance_name):
        self.logger.info(" Suspending OpenStack instance %s" % instance_name)
        if self.is_vm_suspended(instance_name):
            return True

        instance = self._find_instance_by_name(instance_name)
        instance.suspend()
        wait_for(lambda: self.is_vm_suspended(instance_name), message="suspend %s" % instance_name)
开发者ID:nachandr,项目名称:mgmtsystem,代码行数:8,代码来源:openstack.py


示例16: _wait_template_ok

 def _wait_template_ok(self, template_name):
     try:
         wait_for(
             lambda:
             self.api.templates.get(name=template_name).get_status().state == "ok",
             num_sec=30 * 60, message="template is OK", delay=45)
     except AttributeError:  # .get() returns None when template not found
         raise VMInstanceNotFound("Template {} not found!".format(template_name))
开发者ID:jteehan,项目名称:mgmtsystem,代码行数:8,代码来源:rhevm.py


示例17: test_db_migrate_replication

def test_db_migrate_replication(temp_appliance_remote, dbversion, temp_appliance_global_region):
    """
    Polarion:
        assignee: jhenner
        initialEstimate: 1/4h
        casecomponent: Appliance
    """
    app = temp_appliance_remote
    app2 = temp_appliance_global_region
    # Download the database
    logger.info("Downloading database: {}".format(dbversion))
    db_url = cfme_data['db_backups'][dbversion]['url']
    url_basename = os_path.basename(db_url)
    result = app.ssh_client.run_command(
        'curl -o "/tmp/{}" "{}"'.format(url_basename, db_url), timeout=30)
    assert result.success, "Failed to download database: {}".format(result.output)
    # The v2_key is potentially here
    v2key_url = os_path.join(os_path.dirname(db_url), "v2_key")
    # Stop EVM service and drop vmdb_production DB
    app.evmserverd.stop()
    app.db.drop()
    app.db.create()
    # restore new DB and migrate it
    result = app.ssh_client.run_command(
        'pg_restore -v --dbname=vmdb_production /tmp/{}'.format(url_basename), timeout=600)
    assert result.success, "Failed to restore new database: {}".format(result.output)
    app.db.migrate()
    # fetch v2_key
    try:
        result = app.ssh_client.run_command(
            'curl "{}"'.format(v2key_url), timeout=15)
        assert result.success, "Failed to download v2_key: {}".format(result.output)
        assert ":key:" in result.output, "Not a v2_key file: {}".format(result.output)
        result = app.ssh_client.run_command(
            'curl -o "/var/www/miq/vmdb/certs/v2_key" "{}"'.format(v2key_url), timeout=15)
        assert result.success, "Failed to download v2_key: {}".format(result.output)
    # or change all invalid (now unavailable) passwords to 'invalid'
    except AssertionError:
        app.db.fix_auth_key()
    app.db.fix_auth_dbyml()
    # start evmserverd, wait for web UI to start and try to log in
    try:
        app.evmserverd.start()
    except ApplianceException:
        result = app.ssh_client.run_rake_command("evm:start")
        assert result.success, "Couldn't start evmserverd: {}".format(result.output)
    app.wait_for_web_ui(timeout=600)
    # Reset user's password, just in case (necessary for customer DBs)
    app.db.reset_user_pass()
    app.server.login(app.user)

    app.set_pglogical_replication(replication_type=':remote')
    app2.set_pglogical_replication(replication_type=':global')
    app2.add_pglogical_replication_subscription(app.hostname)

    def is_provider_replicated(app, app2):
        return set(app.managed_provider_names) == set(app2.managed_provider_names)
    wait_for(is_provider_replicated, func_args=[app, app2], timeout=30)
开发者ID:apagac,项目名称:cfme_tests,代码行数:58,代码来源:test_db_migrate.py


示例18: test_appliance_console_datetime

def test_appliance_console_datetime(temp_appliance_preconfig_funcscope):
    """Grab fresh appliance and set time and date through appliance_console and check result"""
    app = temp_appliance_preconfig_funcscope
    command_set = ('ap', '', '3', 'y', '2020-10-20', '09:58:00', 'y', '')
    app.appliance_console.run_commands(command_set)

    def date_changed():
        return app.ssh_client.run_command("date +%F-%T | grep 2020-10-20-10:00").success
    wait_for(date_changed)
开发者ID:lcouzens,项目名称:cfme_tests,代码行数:9,代码来源:test_appliance_console.py


示例19: test_appliance_console_dedicated_db

def test_appliance_console_dedicated_db(unconfigured_appliance, app_creds):
    """'ap' launch appliance_console, '' clear info screen, '5' setup db, '1' Creates v2_key,
    '1' selects internal db, 'y' continue, '1' use partition, 'y' create dedicated db, 'pwd'
    db password, 'pwd' confirm db password + wait 360 secs and '' finish."""

    pwd = app_creds['password']
    command_set = ('ap', '', '5', '1', '1', 'y', '1', 'y', pwd, TimedCommand(pwd, 360), '')
    unconfigured_appliance.appliance_console.run_commands(command_set)
    wait_for(lambda: unconfigured_appliance.db.is_dedicated_active)
开发者ID:lcouzens,项目名称:cfme_tests,代码行数:9,代码来源:test_appliance_console.py


示例20: test_appliance_console_extend_storage

def test_appliance_console_extend_storage(unconfigured_appliance):
    """'ap' launches appliance_console, '' clears info screen, '9' extend storage, '1' select
    disk, 'y' confirm configuration and '' complete."""
    command_set = ('ap', '', '9', '1', 'y', '')
    unconfigured_appliance.appliance_console.run_commands(command_set)

    def is_storage_extended():
        assert unconfigured_appliance.ssh_client.run_command("df -h | grep /var/www/miq_tmp")
    wait_for(is_storage_extended)
开发者ID:lcouzens,项目名称:cfme_tests,代码行数:9,代码来源:test_appliance_console.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python waiting.wait函数代码示例发布时间:2022-05-26
下一篇:
Python models.UserProfile类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap