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


Python exceptions.InvalidConfiguration方法代码示例

本文整理汇总了Python中tempest.lib.exceptions.InvalidConfiguration方法的典型用法代码示例。如果您正苦于以下问题:Python exceptions.InvalidConfiguration方法的具体用法?Python exceptions.InvalidConfiguration怎么用?Python exceptions.InvalidConfiguration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tempest.lib.exceptions的用法示例。


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

示例1: create_networks

# 需要导入模块: from tempest.lib import exceptions [as 别名]
# 或者: from tempest.lib.exceptions import InvalidConfiguration [as 别名]
def create_networks(cls):
        """Create a network with a subnet connected to a router.

        Return existed network specified in compute/fixed_network_name
        config option.
        TODO(vsaienko): Add network/subnet/router when we setup
        ironic-standalone with multitenancy.

        :returns: network, subnet, router
        """
        network = None
        subnet = None
        router = None
        if CONF.network.shared_physical_network:
            if not CONF.compute.fixed_network_name:
                m = ('Configuration option "[compute]/fixed_network_name" '
                     'must be set.')
                raise lib_exc.InvalidConfiguration(m)
            network = cls.os_admin.networks_client.list_networks(
                name=CONF.compute.fixed_network_name)['networks'][0]
        return network, subnet, router 
开发者ID:openstack,项目名称:ironic-tempest-plugin,代码行数:23,代码来源:baremetal_standalone_manager.py

示例2: get_server_ip

# 需要导入模块: from tempest.lib import exceptions [as 别名]
# 或者: from tempest.lib.exceptions import InvalidConfiguration [as 别名]
def get_server_ip(self, server):
        """Get the server fixed or floating IP.

        Based on the configuration we're in, return a correct ip
        address for validating that a guest is up.
        """
        if CONF.validation.connect_method == 'floating':
            # The tests calling this method don't have a floating IP
            # and can't make use of the validation resources. So the
            # method is creating the floating IP there.
            return self.create_floating_ip(server)['ip']
        elif CONF.validation.connect_method == 'fixed':
            # Determine the network name to look for based on config or creds
            # provider network resources.
            if CONF.validation.network_for_ssh:
                addresses = server['addresses'][
                    CONF.validation.network_for_ssh]
            else:
                creds_provider = self._get_credentials_provider()
                net_creds = creds_provider.get_primary_creds()
                network = getattr(net_creds, 'network', None)
                addresses = (server['addresses'][network['name']]
                             if network else [])
            for address in addresses:
                if (address['version'] == CONF.validation.ip_version_for_ssh
                        and address['OS-EXT-IPS:type'] == 'fixed'):
                    return address['addr']
            raise exceptions.ServerUnreachable(server_id=server['id'])
        else:
            raise lib_exc.InvalidConfiguration() 
开发者ID:openstack,项目名称:vmware-nsx-tempest-plugin,代码行数:32,代码来源:manager.py

示例3: resource_setup

# 需要导入模块: from tempest.lib import exceptions [as 别名]
# 或者: from tempest.lib.exceptions import InvalidConfiguration [as 别名]
def resource_setup(cls):
        super(BaremetalStandaloneScenarioTest, cls).resource_setup()
        base.set_baremetal_api_microversion(cls.api_microversion)
        for v in cls.mandatory_attr:
            if getattr(cls, v) is None:
                raise lib_exc.InvalidConfiguration(
                    "Mandatory attribute %s not set." % v)
        image_checksum = None
        if not uuidutils.is_uuid_like(cls.image_ref):
            image_checksum = cls.image_checksum
        cls.node = cls.boot_node(cls.driver, cls.image_ref,
                                 image_checksum=image_checksum)
        cls.node_ip = cls.add_floatingip_to_node(cls.node['uuid']) 
开发者ID:openstack,项目名称:ironic-tempest-plugin,代码行数:15,代码来源:baremetal_standalone_manager.py

示例4: test_auth_allowed_empty_roles

# 需要导入模块: from tempest.lib import exceptions [as 别名]
# 或者: from tempest.lib.exceptions import InvalidConfiguration [as 别名]
def test_auth_allowed_empty_roles(self):
        self.rbac_auth.roles_dict = None
        self.assertRaises(exceptions.InvalidConfiguration,
                          self.rbac_auth.allowed, "", "") 
开发者ID:openstack,项目名称:patrole,代码行数:6,代码来源:test_requirements_authority.py

示例5: test_parser_except_invalid_configuration

# 需要导入模块: from tempest.lib import exceptions [as 别名]
# 或者: from tempest.lib.exceptions import InvalidConfiguration [as 别名]
def test_parser_except_invalid_configuration(self):
        req_auth.RequirementsParser.Inner._rbac_map = \
            [{'Test': self.expected_result}]
        self.rbac_auth.roles_dict = \
            req_auth.RequirementsParser.parse("Failure")

        self.assertIsNone(self.rbac_auth.roles_dict)
        self.assertRaises(exceptions.InvalidConfiguration,
                          self.rbac_auth.allowed, "", "") 
开发者ID:openstack,项目名称:patrole,代码行数:11,代码来源:test_requirements_authority.py

示例6: test_create_backup

# 需要导入模块: from tempest.lib import exceptions [as 别名]
# 或者: from tempest.lib.exceptions import InvalidConfiguration [as 别名]
def test_create_backup(self):
        # Prioritize glance v2 over v1 for deleting/waiting for image status.
        if CONF.image_feature_enabled.api_v2:
            glance_admin_client = self.os_admin.image_client_v2
        elif CONF.image_feature_enabled.api_v1:
            glance_admin_client = self.os_admin.image_client
        else:
            raise lib_exc.InvalidConfiguration(
                'Either api_v1 or api_v2 must be True in '
                '[image-feature-enabled].')

        backup_name = data_utils.rand_name(self.__class__.__name__ + '-Backup')

        self.rbac_utils.switch_role(self, toggle_rbac_role=True)
        resp = self.servers_client.create_backup(
            self.server_id, backup_type='daily', rotation=1,
            name=backup_name).response

        # Prior to microversion 2.45, image ID must be parsed from location
        # header. With microversion 2.45+, image_id is returned.
        if api_version_utils.compare_version_header_to_response(
                "OpenStack-API-Version", "2.45", resp, "lt"):
            image_id = resp['image_id']
        else:
            image_id = data_utils.parse_image_id(resp['location'])

        # Use admin credentials to wait since waiting involves show, which is
        # a different policy.
        self.addCleanup(test_utils.call_and_ignore_notfound_exc,
                        glance_admin_client.delete_image, image_id)
        waiters.wait_for_image_status(glance_admin_client, image_id, 'active') 
开发者ID:openstack,项目名称:patrole,代码行数:33,代码来源:test_server_actions_rbac.py

示例7: setup_clients

# 需要导入模块: from tempest.lib import exceptions [as 别名]
# 或者: from tempest.lib.exceptions import InvalidConfiguration [as 别名]
def setup_clients(cls):
        super(ImagesRbacTest, cls).setup_clients()
        if CONF.image_feature_enabled.api_v2:
            cls.glance_image_client = cls.os_primary.image_client_v2
        elif CONF.image_feature_enabled.api_v1:
            cls.glance_image_client = cls.os_primary.image_client
        else:
            raise lib_exc.InvalidConfiguration(
                'Either api_v1 or api_v2 must be True in '
                '[image-feature-enabled].') 
开发者ID:openstack,项目名称:patrole,代码行数:12,代码来源:test_images_rbac.py

示例8: allowed

# 需要导入模块: from tempest.lib import exceptions [as 别名]
# 或者: from tempest.lib.exceptions import InvalidConfiguration [as 别名]
def allowed(self, rule_name, role):
        if self.roles_dict is None:
            raise exceptions.InvalidConfiguration(
                "Roles dictionary parsed from requirements YAML file is "
                "empty. Ensure the requirements YAML file is correctly "
                "formatted.")
        try:
            _api = self.roles_dict[rule_name]
            return role in _api
        except KeyError:
            raise KeyError("'%s' API is not defined in the requirements YAML "
                           "file" % rule_name)
        return False 
开发者ID:openstack,项目名称:patrole,代码行数:15,代码来源:requirements_authority.py

示例9: setup_clients

# 需要导入模块: from tempest.lib import exceptions [as 别名]
# 或者: from tempest.lib.exceptions import InvalidConfiguration [as 别名]
def setup_clients(cls):
        super(ScenarioTest, cls).setup_clients()
        # Clients (in alphabetical order)
        cls.flavors_client = cls.os_primary.flavors_client
        cls.compute_floating_ips_client = (
            cls.os_primary.compute_floating_ips_client)
        if CONF.service_available.glance:
            # Check if glance v1 is available to determine which client to use.
            if CONF.image_feature_enabled.api_v1:
                cls.image_client = cls.os_primary.image_client
            elif CONF.image_feature_enabled.api_v2:
                cls.image_client = cls.os_primary.image_client_v2
            else:
                raise lib_exc.InvalidConfiguration(
                    'Either api_v1 or api_v2 must be True in '
                    '[image-feature-enabled].')
        # Compute image client
        cls.compute_images_client = cls.os_primary.compute_images_client
        cls.keypairs_client = cls.os_primary.keypairs_client
        # Nova security groups client
        cls.compute_security_groups_client = (
            cls.os_primary.compute_security_groups_client)
        cls.compute_security_group_rules_client = (
            cls.os_primary.compute_security_group_rules_client)
        cls.servers_client = cls.os_primary.servers_client
        cls.interface_client = cls.os_primary.interfaces_client
        # Neutron network client
        cls.networks_client = cls.os_primary.networks_client
        cls.ports_client = cls.os_primary.ports_client
        cls.routers_client = cls.os_primary.routers_client
        cls.subnets_client = cls.os_primary.subnets_client
        cls.floating_ips_client = cls.os_primary.floating_ips_client
        cls.security_groups_client = cls.os_primary.security_groups_client
        cls.security_group_rules_client = (
            cls.os_primary.security_group_rules_client)

        if CONF.volume_feature_enabled.api_v2:
            cls.volumes_client = cls.os_primary.volumes_v2_client
            cls.snapshots_client = cls.os_primary.snapshots_v2_client
        else:
            cls.volumes_client = cls.os_primary.volumes_client
            cls.snapshots_client = cls.os_primary.snapshots_client

    # ## Test functions library
    #
    # The create_[resource] functions only return body and discard the
    # resp part which is not used in scenario tests 
开发者ID:openstack,项目名称:watcher-tempest-plugin,代码行数:49,代码来源:manager.py

示例10: create_networks

# 需要导入模块: from tempest.lib import exceptions [as 别名]
# 或者: from tempest.lib.exceptions import InvalidConfiguration [as 别名]
def create_networks(self, networks_client=None,
                        routers_client=None, subnets_client=None,
                        tenant_id=None, dns_nameservers=None,
                        port_security_enabled=True):
        """Create a network with a subnet connected to a router.

        The baremetal driver is a special case since all nodes are
        on the same shared network.

        :param tenant_id: id of tenant to create resources in.
        :param dns_nameservers: list of dns servers to send to subnet.
        :returns: network, subnet, router
        """
        if CONF.network.shared_physical_network:
            # NOTE(Shrews): This exception is for environments where tenant
            # credential isolation is available, but network separation is
            # not (the current baremetal case). Likely can be removed when
            # test account mgmt is reworked:
            # https://blueprints.launchpad.net/tempest/+spec/test-accounts
            if not CONF.compute.fixed_network_name:
                m = 'fixed_network_name must be specified in config'
                raise lib_exc.InvalidConfiguration(m)
            network = self._get_network_by_name(
                CONF.compute.fixed_network_name)
            router = None
            subnet = None
        else:
            network = self._create_network(
                networks_client=networks_client,
                tenant_id=tenant_id,
                port_security_enabled=port_security_enabled)
            router = self._get_router(client=routers_client,
                                      tenant_id=tenant_id)
            subnet_kwargs = dict(network=network,
                                 subnets_client=subnets_client,
                                 routers_client=routers_client)
            # use explicit check because empty list is a valid option
            if dns_nameservers is not None:
                subnet_kwargs['dns_nameservers'] = dns_nameservers
            subnet = self._create_subnet(**subnet_kwargs)
            if not routers_client:
                routers_client = self.routers_client
            router_id = router['id']
            routers_client.add_router_interface(router_id,
                                                subnet_id=subnet['id'])

            # save a cleanup job to remove this association between
            # router and subnet
            self.addCleanup(test_utils.call_and_ignore_notfound_exc,
                            routers_client.remove_router_interface, router_id,
                            subnet_id=subnet['id'])
        return network, subnet, router 
开发者ID:openstack,项目名称:vmware-nsx-tempest-plugin,代码行数:54,代码来源:manager.py

示例11: setup_clients

# 需要导入模块: from tempest.lib import exceptions [as 别名]
# 或者: from tempest.lib.exceptions import InvalidConfiguration [as 别名]
def setup_clients(cls):
        super(ScenarioTest, cls).setup_clients()
        # Clients (in alphabetical order)
        cls.flavors_client = cls.manager.flavors_client
        cls.compute_floating_ips_client = (
            cls.manager.compute_floating_ips_client)
        if CONF.service_available.glance:
            # Check if glance v1 is available to determine which client to use.
            if CONF.image_feature_enabled.api_v1:
                cls.image_client = cls.manager.image_client
            elif CONF.image_feature_enabled.api_v2:
                cls.image_client = cls.manager.image_client_v2
            else:
                raise lib_exc.InvalidConfiguration(
                    'Either api_v1 or api_v2 must be True in '
                    '[image-feature-enabled].')
        # Compute image client
        cls.compute_images_client = cls.manager.compute_images_client
        cls.keypairs_client = cls.manager.keypairs_client
        # Nova security groups client
        cls.compute_security_groups_client = (
            cls.manager.compute_security_groups_client)
        cls.compute_security_group_rules_client = (
            cls.manager.compute_security_group_rules_client)
        cls.servers_client = cls.manager.servers_client
        cls.interface_client = cls.manager.interfaces_client
        # Neutron network client
        cls.networks_client = cls.manager.networks_client
        cls.ports_client = cls.manager.ports_client
        cls.routers_client = cls.manager.routers_client
        cls.subnets_client = cls.manager.subnets_client
        cls.floating_ips_client = cls.manager.floating_ips_client
        cls.security_groups_client = cls.manager.security_groups_client
        cls.security_group_rules_client = (
            cls.manager.security_group_rules_client)

        if CONF.volume_feature_enabled.api_v2:
            cls.volumes_client = cls.manager.volumes_v2_client
            cls.snapshots_client = cls.manager.snapshots_v2_client
        else:
            cls.volumes_client = cls.manager.volumes_client
            cls.snapshots_client = cls.manager.snapshots_client

    # ## Test functions library
    #
    # The create_[resource] functions only return body and discard the
    # resp part which is not used in scenario tests 
开发者ID:openstack,项目名称:nova-lxd,代码行数:49,代码来源:manager.py

示例12: setup_clients

# 需要导入模块: from tempest.lib import exceptions [as 别名]
# 或者: from tempest.lib.exceptions import InvalidConfiguration [as 别名]
def setup_clients(cls):
        super(ScenarioTest, cls).setup_clients()
        # Clients (in alphabetical order)
        cls.flavors_client = cls.os_primary.flavors_client
        cls.compute_floating_ips_client = (
            cls.os_primary.compute_floating_ips_client)
        if CONF.service_available.glance:
            # Check if glance v1 is available to determine which client to use.
            if CONF.image_feature_enabled.api_v1:
                cls.image_client = cls.os_primary.image_client
            elif CONF.image_feature_enabled.api_v2:
                cls.image_client = cls.os_primary.image_client_v2
            else:
                raise lib_exc.InvalidConfiguration(
                    'Either api_v1 or api_v2 must be True in '
                    '[image-feature-enabled].')
        # Compute image client
        cls.compute_images_client = cls.os_primary.compute_images_client
        cls.keypairs_client = cls.os_primary.keypairs_client
        # Nova security groups client
        cls.compute_security_groups_client = (
            cls.os_primary.compute_security_groups_client)
        cls.compute_security_group_rules_client = (
            cls.os_primary.compute_security_group_rules_client)
        cls.servers_client = cls.os_primary.servers_client
        # Neutron network client
        cls.networks_client = cls.os_primary.networks_client
        cls.ports_client = cls.os_primary.ports_client
        cls.routers_client = cls.os_primary.routers_client
        cls.subnets_client = cls.os_primary.subnets_client
        cls.floating_ips_client = cls.os_primary.floating_ips_client
        cls.security_groups_client = cls.os_primary.security_groups_client
        cls.security_group_rules_client = (
            cls.os_primary.security_group_rules_client)

        if CONF.volume_feature_enabled.api_v2:
            cls.volumes_client = cls.os_primary.volumes_v2_client
            cls.snapshots_client = cls.os_primary.snapshots_v2_client
        else:
            cls.volumes_client = cls.os_primary.volumes_client
            cls.snapshots_client = cls.os_primary.snapshots_client

    # ## Test functions library
    #
    # The create_[resource] functions only return body and discard the
    # resp part which is not used in scenario tests 
开发者ID:openstack,项目名称:barbican-tempest-plugin,代码行数:48,代码来源:manager.py


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