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


Python version.current_version函数代码示例

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


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

示例1: docs_info

def docs_info():
    if version.current_version() < "5.4.0.1":
        return [
            'Control',
            'Lifecycle and Automation',
            'Quick Start',
            'Settings And Operations',
            'Insight',
            'Integration Services'
        ]
    elif version.current_version() < "5.5.0.12":
        return [
            'Insight',
            'Control',
            'Lifecycle and Automation',
            'REST API',
            'SOAP API',
            'User',
            'Settings and Operations'
        ]
    elif version.appliance_is_downstream():
        return [
            'Monitoring Alerts Reporting',
            'General Configuration',
            'Virtual Machines Hosts',
            'Methods For Automation',
            'Infrastructure Inventory',
            'Providers',
            'Scripting Actions',
            'Defining Policies Profiles'
        ]
    else:
        # Upstream version has no docs
        return []
开发者ID:MattLombana,项目名称:cfme_tests,代码行数:34,代码来源:test_docs.py

示例2: get_current_menu_state

    def get_current_menu_state(self):
        """Returns the current menu state

        This function returns what each level of the menu is pointing to, or None, if that level
        of menu is unused. Future work could possibly see this method using recursion to allow
        unlimited levels of menu to be used, however it is unlikely that more than 3 will ever be
        used.
        """
        lev = [None, None, None]
        lev[0] = (sel.text(self.CURRENT_TOP_MENU).encode("utf-8").strip())
        if version.current_version() < "5.6.0.1" or version.current_version() == version.LATEST:
            try:
                lev[1] = sel.text("//nav[contains(@class, 'navbar')]//ul/li[@class='active']/a") \
                    .encode("utf-8").strip()
            except NoSuchElementException:
                pass
        else:
            lev[1] = sel.text("{}{}".format(
                self.CURRENT_TOP_MENU, self.ACTIVE_LEV)).encode("utf-8").strip()
            try:
                lev[2] = sel.text("{}{}{}".format(
                    self.CURRENT_TOP_MENU, self.ACTIVE_LEV, self.ACTIVE_LEV)).encode(
                        "utf-8").strip()
            except NoSuchElementException:
                pass

        return lev
开发者ID:sakthivelramakrishnan,项目名称:cfme_tests,代码行数:27,代码来源:menu.py

示例3: test_retire_service_future

    def test_retire_service_future(self, rest_api, services):
        """Test retiring a service
        Prerequisities:
            * An appliance with ``/api`` available.
        Steps:
            * Retrieve list of entities using GET /api/services , pick the first one
            * POST /api/service/<id> (method ``retire``) with the ``retire_date``
        Metadata:
            test_flag: rest
        """
        assert "retire" in rest_api.collections.services.action.all

        retire_service = services[0]
        date = (datetime.datetime.now() + datetime.timedelta(days=5)).strftime('%m/%d/%y')
        future = {
            "date": date,
            "warn": "4",
        }
        date_before = retire_service.updated_at
        retire_service.action.retire(future)

        def _finished():
            retire_service.reload()
            if retire_service.updated_at > date_before:
                    return True
            return False

        wait_for(_finished, num_sec=600, delay=5, message="REST automation_request finishes")

        @pytest.mark.uncollectif(lambda: version.current_version() < '5.5')
        def test_set_service_owner(self, rest_api, services):
            if "set_ownership" not in rest_api.collections.services.action.all:
                pytest.skip("Set owner action for service is not implemented in this version")
            service = services[0]
            user = rest_api.collections.users.get(userid='admin')
            data = {
                "owner": {"href": user.href}
            }
            service.action.set_ownership(data)
            service.reload()
            assert hasattr(service, "evm_owner")
            assert service.evm_owner.userid == user.userid

        @pytest.mark.uncollectif(lambda: version.current_version() < '5.5')
        def test_set_services_owner(self, rest_api, services):
            if "set_ownership" not in rest_api.collections.services.action.all:
                pytest.skip("Set owner action for service is not implemented in this version")
            data = []
            user = rest_api.collections.users.get(userid='admin')
            for service in services:
                tmp_data = {
                    "href": service.href,
                    "owner": {"href": user.href}
                }
                data.append(tmp_data)
            rest_api.collections.services.action.set_ownership(*data)
            for service in services:
                service.reload()
                assert hasattr(service, "evm_owner")
                assert service.evm_owner.userid == user.userid
开发者ID:ManageIQ,项目名称:integration_tests,代码行数:60,代码来源:test_rest_services.py

示例4: test_evmserverd_start_twice

def test_evmserverd_start_twice(ssh_client):
    """If evmserverd start is ran twice, it will then tell that it is already running.

    Steps:
        * Stop the evmserverd using ``service evmserverd stop``.
        * Start the evmserverd using ``service evmserverd start`` command.
        * Assert that the output of the previous command states "Running EVM in background".
        * Start the evmserverd using ``service evmserverd start`` command.
        * Assert that the output of the previous command states "EVM is already running".
        * Extract the PID of the evmserverd from the output from the last command.
        * Verify the process with such PID exists ``kill -0 $PID``.
    """
    assert ssh_client.run_command("service evmserverd stop").rc == 0
    # Start first time
    res = ssh_client.run_command("service evmserverd start")
    if current_version() < "5.5":
        assert "running evm in background" in res.output.lower()
    else:
        assert "started evm server daemon" in res.output.lower()
    assert res.rc == 0
    # Start second time
    res = ssh_client.run_command("service evmserverd start")
    if current_version() < "5.5":
        assert "evm is already running" in res.output.lower()
    assert res.rc == 0
    # Verify the process is running
    if current_version() < "5.5":
        pid_match = re.search(r"\(PID=(\d+)\)", res.output)
    else:
        pid_match = re.search(r"Main PID: (\d+)", res.output)
    assert pid_match is not None
    pid = int(pid_match.groups()[0])
    assert ssh_client.run_command("kill -0 {}".format(pid)).rc == 0
开发者ID:pombredanne,项目名称:cfme_tests,代码行数:33,代码来源:test_evmserverd.py

示例5: all_possible_roles

def all_possible_roles():
    roles = server_roles_conf['all']
    if version.current_version() < 5.6:
        roles.remove('git_owner')
        roles.remove('websocket')
    if version.current_version() >= 5.7:
        roles.remove('database_synchronization')
    return roles
开发者ID:RonnyPfannschmidt,项目名称:cfme_tests,代码行数:8,代码来源:test_server_roles.py

示例6: create

    def create(self):
        # Create has sequential forms, the first is only the provider type
        navigate_to(self, 'Add')
        # For element not found exception (To be removed)
        sel.sleep(5)
        sel.select("//select[@id='st_prov_type']",
                   self.provider_type or self.item_type or 'Generic')

        sel.wait_for_element(basic_info_form.name_text)
        catalog = fakeobject_or_object(self.catalog, "name", "Unassigned")
        dialog = fakeobject_or_object(self.dialog, "name", "No Dialog")

        # Need to provide the (optional) provider name to the form, not the object
        provider_name = None
        provider_required_types = ['AnsibleTower', 'Orchestration']
        if self.item_type in provider_required_types \
                or self.provider_type in provider_required_types:
            provider_name = self.provider.name
        # For tests where orchestration template is None
        orch_template = None
        if self.orch_template:
            orch_template = self.orch_template.template_name

        fill(basic_info_form, {'name_text': self.name,
                               'description_text': self.description,
                               'display_checkbox': self.display_in,
                               'select_catalog': catalog.name,
                               'select_dialog': dialog.name,
                               'select_orch_template': orch_template,
                               'select_provider': provider_name,
                               'select_config_template': self.config_template})
        if not (self.item_type in provider_required_types):
            sel.click(basic_info_form.field_entry_point)
            if version.current_version() < "5.7":
                dynamic_tree.click_path("Datastore", self.domain, "Service", "Provisioning",
                                     "StateMachines", "ServiceProvision_Template", "default")
            else:
                entry_tree.click_path("Datastore", self.domain, "Service", "Provisioning",
                    "StateMachines", "ServiceProvision_Template", "default")
            sel.click(basic_info_form.apply_btn)
        if version.current_version() >= "5.7" and self.item_type == "AnsibleTower":
            sel.click(basic_info_form.retirement_entry_point)
            entry_tree.click_path("Datastore", self.domain, "Service", "Retirement",
                    "StateMachines", "ServiceRetirement", "Generic")
            sel.click(basic_info_form.apply_btn)
        if self.catalog_name is not None \
                and self.provisioning_data is not None \
                and not isinstance(self.provider, NoneType):
            tabstrip.select_tab("Request Info")
            tabstrip.select_tab("Catalog")
            template = template_select_form.template_table.find_row_by_cells({
                'Name': self.catalog_name,
                'Provider': self.provider.name
            })
            sel.click(template)
            request_form.fill(self.provisioning_data)
        sel.click(template_select_form.add_button)
开发者ID:rananda,项目名称:cfme_tests,代码行数:57,代码来源:catalog_item.py

示例7: resolve_blocker

 def resolve_blocker(self, blocker, version=None, ignore_bugs=None, force_block_streams=None):
     # ignore_bugs is mutable but is not mutated here! Same force_block_streams
     force_block_streams = force_block_streams or []
     ignore_bugs = set([]) if not ignore_bugs else ignore_bugs
     if isinstance(id, BugWrapper):
         bug = blocker
     else:
         bug = self.get_bug(blocker)
     if version is None:
         version = current_version()
     if version == LATEST:
         version = bug.product.latest_version
     variants = self.get_bug_variants(bug)
     filtered = set([])
     version_series = ".".join(str(version).split(".")[:2])
     for variant in variants:
         if variant.id in ignore_bugs:
             continue
         if variant.version is not None and variant.version > version:
             continue
         if ((variant.version is not None and variant.target_release is not None) and
                 (
                     variant.version.is_in_series(version_series) or
                     variant.target_release.is_in_series(version_series))):
                 filtered.add(variant)
         elif variant.release_flag is not None:
             if version.is_in_series(variant.release_flag):
                 # Simple case
                 filtered.add(variant)
             else:
                 logger.info(
                     "Ignoring bug #%s, appliance version not in bug release flag", variant.id)
         else:
             logger.info("No release flags, wrong versions, ignoring %s", variant.id)
     if not filtered:
         # No appropriate bug was found
         for forced_stream in force_block_streams:
             # Find out if we force this bug.
             if current_version().is_in_series(forced_stream):
                 return bug
         else:
             # No bug, yipee :)
             return None
     # First, use versions
     for bug in filtered:
         if ((bug.version is not None and bug.target_release is not None) and
                 check_fixed_in(bug.fixed_in, version_series) and
                 (
                     bug.version.is_in_series(version_series) or
                     bug.target_release.is_in_series(version_series))):
             return bug
     # Otherwise prefer release_flag
     for bug in filtered:
         if bug.release_flag and version.is_in_series(bug.release_flag):
             return bug
     return None
开发者ID:dajohnso,项目名称:cfme_tests,代码行数:56,代码来源:bz.py

示例8: group_data

def group_data():
    roles = cfme_data.get("group_roles", {})

    # These roles are not present on 5.2 appliance in these groups
    if version.current_version() < "5.3":
        _remove_page(roles, "evmgroup-super_administrator", ["clouds_tenants"])
        _remove_page(roles, "evmgroup-user", ["services_requests", "infrastructure_requests"])
    if version.current_version() < "5.4":
        _remove_from_all(roles, "clouds_stacks")
        _remove_from_all(roles, "infrastructure_config_management")
    return roles
开发者ID:pombredanne,项目名称:cfme_tests,代码行数:11,代码来源:roles.py

示例9: visible_pages

    def visible_pages(self):
        """Return a list of all the menu pages currently visible top- and second-level pages

        Mainly useful for RBAC testing

        """
        if version.current_version() < "5.6.0.1" or version.current_version() == version.LATEST:
            displayed_menus = self._old_visible_pages()
        else:
            displayed_menus = self._new_visible_pages()
        return sorted(
            [self.reverse_lookup(*displayed) for displayed in displayed_menus if displayed])
开发者ID:sakthivelramakrishnan,项目名称:cfme_tests,代码行数:12,代码来源:menu.py

示例10: initialize

 def initialize(self):
     """Initializes the menu object by collapsing the grafted tree items onto the tree"""
     if not self._branches:
         self._branches = self._branch_convert(self.sections)
         self.add_branch('toplevel', self._branches)
         while self._branch_stack:
             name, branches = self._branch_stack.pop(0)
             self.add_branch(name, branches)
         if version.current_version() < "5.6.0.1" or version.current_version() == version.LATEST:
             self.CURRENT_TOP_MENU = "//ul[@id='maintab']/li[not(contains(@class, 'drop'))]/a[2]"
         else:
             self.CURRENT_TOP_MENU = "{}{}".format(self.ROOT, self.ACTIVE_LEV)
开发者ID:sakthivelramakrishnan,项目名称:cfme_tests,代码行数:12,代码来源:menu.py

示例11: form

        def form(self):
            fields = [
                ('token_secret_55', Input('bearer_token')),
                ('google_service_account', Input('service_account')),
            ]
            tab_fields = {
                ("Default", ('default_when_no_tabs', )): [
                    ('default_principal', Input("default_userid")),
                    ('default_secret', Input("default_password")),
                    ('default_verify_secret', Input("default_verify")),
                    ('token_secret', {
                        version.LOWEST: Input('bearer_password'),
                        '5.6': Input('default_password')
                    }),
                    ('token_verify_secret', {
                        version.LOWEST: Input('bearer_verify'),
                        '5.6': Input('default_verify')
                    }),
                ],

                "RSA key pair": [
                    ('ssh_user', Input("ssh_keypair_userid")),
                    ('ssh_key', FileInput("ssh_keypair_password")),
                ],

                "C & U Database": [
                    ('candu_principal', Input("metrics_userid")),
                    ('candu_secret', Input("metrics_password")),
                    ('candu_verify_secret', Input("metrics_verify")),
                ],
            }
            fields_end = [
                ('validate_btn', form_buttons.validate),
            ]

            if version.current_version() >= '5.6':
                amevent = "Events"
            else:
                amevent = "AMQP"
            tab_fields[amevent] = []
            if version.current_version() >= "5.6":
                tab_fields[amevent].append(('event_selection', Radio('event_stream_selection')))
            tab_fields[amevent].extend([
                ('amqp_principal', Input("amqp_userid")),
                ('amqp_secret', Input("amqp_password")),
                ('amqp_verify_secret', Input("amqp_verify")),
            ])

            return TabStripForm(fields=fields, tab_fields=tab_fields, fields_end=fields_end)
开发者ID:rananda,项目名称:cfme_tests,代码行数:49,代码来源:provider.py

示例12: test_timeprofile_description_required_error_validation

def test_timeprofile_description_required_error_validation():
    tp = st.Timeprofile(
        description=None,
        scope='Current User',
        timezone="(GMT-10:00) Hawaii")
    if version.current_version() > "5.7":
        tp.create(cancel=True)
        assert tp.timeprofile_form.description.angular_help_block == "Required"
        if version.current_version() > "5.8":
            assert form_buttons.save.is_dimmed
        else:
            assert form_buttons.add.is_dimmed
    else:
        with error.expected("Description is required"):
            tp.create()
开发者ID:dajohnso,项目名称:cfme_tests,代码行数:15,代码来源:test_timeprofile.py

示例13: domain

def domain(request):
    if version.current_version() < "5.3":
        return None
    domain = Domain(name=fauxfactory.gen_alphanumeric(), enabled=True)
    domain.create()
    request.addfinalizer(lambda: domain.delete() if domain.exists() else None)
    return domain
开发者ID:pombredanne,项目名称:cfme_tests,代码行数:7,代码来源:test_namespace.py

示例14: _filter_restricted_version

 def _filter_restricted_version(self, provider):
     """ Filters by yaml version restriction; not applied if SSH is not available """
     if self.restrict_version:
         # TODO
         # get rid of this since_version hotfix by translating since_version
         # to restricted_version; in addition, restricted_version should turn into
         # "version_restrictions" and it should be a sequence of restrictions with operators
         # so that we can create ranges like ">= 5.6" and "<= 5.8"
         version_restrictions = []
         since_version = provider.data.get('since_version')
         if since_version:
             version_restrictions.append('>= {}'.format(since_version))
         restricted_version = provider.data.get('restricted_version')
         if restricted_version:
             version_restrictions.append(restricted_version)
         for restriction in version_restrictions:
             for op, comparator in ProviderFilter._version_operator_map.items():
                 # split string by op; if the split works, version won't be empty
                 head, op, ver = restriction.partition(op)
                 if not ver:  # This means that the operator was not found
                     continue
                 try:
                     curr_ver = version.current_version()
                 except:
                     return True
                 if not comparator(curr_ver, ver):
                     return False
                 break
             else:
                 raise Exception('Operator not found in {}'.format(restriction))
     return None
开发者ID:dajohnso,项目名称:cfme_tests,代码行数:31,代码来源:providers.py

示例15: edit_schema

    def edit_schema(self, add_fields=None, remove_fields=None):
        sel.force_navigate("automate_explorer_schema_edit", context={'tree_item': self})
        for remove_field in remove_fields or []:
            f = remove_field.get_form()
            fill(f, {}, action=f.remove_entry_button, action_always=True)
            if version.current_version() < "5.5.0.7":
                sel.handle_alert()

        for add_field in add_fields or []:
            sel.click(self.schema_edit_page.add_field_btn)
            f = add_field.get_form(blank=True)
            fill(f, {'name_text': add_field.name,
                     'type_select': add_field.type_,
                     'data_type_select': add_field.data_type,
                     'default_value_text': add_field.default_value,
                     'description_text': add_field.description,
                     'sub_cb': add_field.sub,
                     'collect_text': add_field.collect,
                     'message_text': add_field.message,
                     'on_entry_text': add_field.on_entry,
                     'on_exit_text': add_field.on_exit,
                     'max_retries_text': add_field.max_retries,
                     'max_time_text': add_field.max_time},
                 action=f.add_entry_button)

        sel.click(form_buttons.save)
        flash.assert_success_message('Schema for Automate Class "%s" was saved' % self.name)
开发者ID:quarckster,项目名称:cfme_tests,代码行数:27,代码来源:explorer.py


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