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


Python exceptions.ResourceNotFound方法代码示例

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


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

示例1: release_vif

# 需要导入模块: from openstack import exceptions [as 别名]
# 或者: from openstack.exceptions import ResourceNotFound [as 别名]
def release_vif(self, pod, vif, project_id=None, security_groups=None):
        os_net = clients.get_network_client()

        attempts = kuryr_config.CONF.pod_vif_nested.rev_update_attempts
        while attempts > 0:
            container_port = os_net.get_port(vif.id)

            container_mac = container_port.mac_address
            container_ips = frozenset(entry['ip_address'] for entry in
                                      container_port.fixed_ips)
            vm_port = self._get_parent_port(pod)
            attempts = self._try_update_port(
                attempts, self._remove_from_allowed_address_pairs,
                vm_port, container_ips, container_mac)

        try:
            os_net.delete_port(vif.id, ignore_missing=False)
        except o_exc.ResourceNotFound:
            LOG.warning("Unable to release port %s as it no longer exists.",
                        vif.id) 
开发者ID:openstack,项目名称:kuryr-kubernetes,代码行数:22,代码来源:nested_macvlan_vif.py

示例2: delete_address_scope

# 需要导入模块: from openstack import exceptions [as 别名]
# 或者: from openstack.exceptions import ResourceNotFound [as 别名]
def delete_address_scope(self, address_scope, ignore_missing=True):
        """Delete an address scope

        :param address_scope: The value can be either the ID of an
            address scope or
            a :class:`~openstack.network.v2.address_scope.AddressScope`
            instance.
        :param bool ignore_missing: When set to ``False``
                    :class:`~openstack.exceptions.ResourceNotFound` will be
                    raised when the address scope does not exist.
                    When set to ``True``, no exception will be set when
                    attempting to delete a nonexistent address scope.

        :returns: ``None``
        """
        self._delete(_address_scope.AddressScope, address_scope,
                     ignore_missing=ignore_missing) 
开发者ID:openstack,项目名称:openstacksdk,代码行数:19,代码来源:_proxy.py

示例3: find_address_scope

# 需要导入模块: from openstack import exceptions [as 别名]
# 或者: from openstack.exceptions import ResourceNotFound [as 别名]
def find_address_scope(self, name_or_id, ignore_missing=True, **args):
        """Find a single address scope

        :param name_or_id: The name or ID of an address scope.
        :param bool ignore_missing: When set to ``False``
                    :class:`~openstack.exceptions.ResourceNotFound` will be
                    raised when the resource does not exist.
                    When set to ``True``, None will be returned when
                    attempting to find a nonexistent resource.
        :param dict args: Any additional parameters to be passed into
                          underlying methods. such as query filters.
        :returns: One :class:`~openstack.network.v2.address_scope.AddressScope`
                  or None
        """
        return self._find(_address_scope.AddressScope, name_or_id,
                          ignore_missing=ignore_missing, **args) 
开发者ID:openstack,项目名称:openstacksdk,代码行数:18,代码来源:_proxy.py

示例4: delete_auto_allocated_topology

# 需要导入模块: from openstack import exceptions [as 别名]
# 或者: from openstack.exceptions import ResourceNotFound [as 别名]
def delete_auto_allocated_topology(self, project=None,
                                       ignore_missing=False):
        """Delete auto-allocated topology

        :param project:
            The value is the ID or name of a project
        :param ignore_missing: When set to ``False``
               :class:`~openstack.exceptions.ResourceNotFound` will be
               raised when the topology does not exist.
               When set to ``True``, no exception will be raised when
               attempting to delete nonexistant topology

        :returns: ``None``
        """

        # If project option is not given, grab project id from session
        if project is None:
            project = self.get_project_id()
        self._delete(_auto_allocated_topology.AutoAllocatedTopology,
                     project, ignore_missing=ignore_missing) 
开发者ID:openstack,项目名称:openstacksdk,代码行数:22,代码来源:_proxy.py

示例5: find_extension

# 需要导入模块: from openstack import exceptions [as 别名]
# 或者: from openstack.exceptions import ResourceNotFound [as 别名]
def find_extension(self, name_or_id, ignore_missing=True, **args):
        """Find a single extension

        :param name_or_id: The name or ID of a extension.
        :param bool ignore_missing: When set to ``False``
                    :class:`~openstack.exceptions.ResourceNotFound` will be
                    raised when the resource does not exist.
                    When set to ``True``, None will be returned when
                    attempting to find a nonexistent resource.
        :param dict args: Any additional parameters to be passed into
                          underlying methods. such as query filters.
        :returns: One :class:`~openstack.network.v2.extension.Extension`
                  or None
        """
        return self._find(extension.Extension, name_or_id,
                          ignore_missing=ignore_missing, **args) 
开发者ID:openstack,项目名称:openstacksdk,代码行数:18,代码来源:_proxy.py

示例6: find_ip

# 需要导入模块: from openstack import exceptions [as 别名]
# 或者: from openstack.exceptions import ResourceNotFound [as 别名]
def find_ip(self, name_or_id, ignore_missing=True, **args):
        """Find a single IP

        :param name_or_id: The name or ID of an IP.
        :param bool ignore_missing: When set to ``False``
                    :class:`~openstack.exceptions.ResourceNotFound` will be
                    raised when the resource does not exist.
                    When set to ``True``, None will be returned when
                    attempting to find a nonexistent resource.
        :param dict args: Any additional parameters to be passed into
                          underlying methods. such as query filters.
        :returns: One :class:`~openstack.network.v2.floating_ip.FloatingIP`
                  or None
        """
        return self._find(_floating_ip.FloatingIP, name_or_id,
                          ignore_missing=ignore_missing, **args) 
开发者ID:openstack,项目名称:openstacksdk,代码行数:18,代码来源:_proxy.py

示例7: get_port_forwarding

# 需要导入模块: from openstack import exceptions [as 别名]
# 或者: from openstack.exceptions import ResourceNotFound [as 别名]
def get_port_forwarding(self, port_forwarding, floating_ip):
        """Get a single port forwarding

        :param port_forwarding: The value can be the ID of a port forwarding
            or a :class:`~openstack.network.v2.port_forwarding.PortForwarding`
            instance.
        :param floating_ip: The value can be the ID of a Floating IP or a
                    :class:`~openstack.network.v2.floating_ip.FloatingIP`
                    instance.

        :returns: One
            :class:`~openstack.network.v2.port_forwarding.PortForwarding`
        :raises: :class:`~openstack.exceptions.ResourceNotFound`
                 when no resource can be found.
        """
        floating_ip = self._get_resource(_floating_ip.FloatingIP, floating_ip)
        return self._get(_port_forwarding.PortForwarding, port_forwarding,
                         floatingip_id=floating_ip.id) 
开发者ID:openstack,项目名称:openstacksdk,代码行数:20,代码来源:_proxy.py

示例8: find_port_forwarding

# 需要导入模块: from openstack import exceptions [as 别名]
# 或者: from openstack.exceptions import ResourceNotFound [as 别名]
def find_port_forwarding(self, pf_id, floating_ip, ignore_missing=True,
                             **args):
        """Find a single port forwarding

        :param pf_id: The ID of a port forwarding.
        :param floating_ip: The value can be the ID of a Floating IP or a
                    :class:`~openstack.network.v2.floating_ip.FloatingIP`
                    instance.
        :param bool ignore_missing: When set to ``False``
                    :class:`~openstack.exceptions.ResourceNotFound` will be
                    raised when the resource does not exist.
                    When set to ``True``, None will be returned when
                    attempting to find a nonexistent resource.
        :param dict args: Any additional parameters to be passed into
                          underlying methods. such as query filters.
        :returns:
            One :class:`~openstack.network.v2.port_forwarding.PortForwarding`
            or None
        """
        floating_ip = self._get_resource(_floating_ip.FloatingIP, floating_ip)
        return self._find(_port_forwarding.PortForwarding, pf_id,
                          floatingip_id=floating_ip.id,
                          ignore_missing=ignore_missing, **args) 
开发者ID:openstack,项目名称:openstacksdk,代码行数:25,代码来源:_proxy.py

示例9: delete_port_forwarding

# 需要导入模块: from openstack import exceptions [as 别名]
# 或者: from openstack.exceptions import ResourceNotFound [as 别名]
def delete_port_forwarding(self, port_forwarding, floating_ip,
                               ignore_missing=True):
        """Delete a port forwarding

        :param port_forwarding: The value can be the ID of a port forwarding
            or a :class:`~openstack.network.v2.port_forwarding.PortForwarding`
            instance.
        :param floating_ip: The value can be the ID of a Floating IP or a
                    :class:`~openstack.network.v2.floating_ip.FloatingIP`
                    instance.
        :param bool ignore_missing: When set to ``False``
                    :class:`~openstack.exceptions.ResourceNotFound` will be
                    raised when the floating ip does not exist.
                    When set to ``True``, no exception will be set when
                    attempting to delete a nonexistent ip.

        :returns: ``None``
        """
        fip = self._get_resource(_floating_ip.FloatingIP, floating_ip)
        self._delete(_port_forwarding.PortForwarding, port_forwarding,
                     floatingip_id=fip.id,
                     ignore_missing=ignore_missing) 
开发者ID:openstack,项目名称:openstacksdk,代码行数:24,代码来源:_proxy.py

示例10: find_health_monitor

# 需要导入模块: from openstack import exceptions [as 别名]
# 或者: from openstack.exceptions import ResourceNotFound [as 别名]
def find_health_monitor(self, name_or_id, ignore_missing=True, **args):
        """Find a single health monitor

        :param name_or_id: The name or ID of a health monitor.
        :param bool ignore_missing: When set to ``False``
                    :class:`~openstack.exceptions.ResourceNotFound` will be
                    raised when the resource does not exist.
                    When set to ``True``, None will be returned when
                    attempting to find a nonexistent resource.
        :param dict args: Any additional parameters to be passed into
                          underlying methods. such as query filters.
        :returns: One :class:`~openstack.network.v2.health_monitor.
                  HealthMonitor` or None
        """
        return self._find(_health_monitor.HealthMonitor,
                          name_or_id, ignore_missing=ignore_missing, **args) 
开发者ID:openstack,项目名称:openstacksdk,代码行数:18,代码来源:_proxy.py

示例11: find_load_balancer

# 需要导入模块: from openstack import exceptions [as 别名]
# 或者: from openstack.exceptions import ResourceNotFound [as 别名]
def find_load_balancer(self, name_or_id, ignore_missing=True, **args):
        """Find a single load balancer

        :param name_or_id: The name or ID of a load balancer.
        :param bool ignore_missing: When set to ``False``
                    :class:`~openstack.exceptions.ResourceNotFound` will be
                    raised when the resource does not exist.
                    When set to ``True``, None will be returned when
                    attempting to find a nonexistent resource.
        :param dict args: Any additional parameters to be passed into
                          underlying methods. such as query filters.
        :returns: One :class:`~openstack.network.v2.load_balancer.LoadBalancer`
                  or None
        """
        return self._find(_load_balancer.LoadBalancer, name_or_id,
                          ignore_missing=ignore_missing, **args) 
开发者ID:openstack,项目名称:openstacksdk,代码行数:18,代码来源:_proxy.py

示例12: delete_metering_label

# 需要导入模块: from openstack import exceptions [as 别名]
# 或者: from openstack.exceptions import ResourceNotFound [as 别名]
def delete_metering_label(self, metering_label, ignore_missing=True):
        """Delete a metering label

        :param metering_label:
                The value can be either the ID of a metering label or a
                :class:`~openstack.network.v2.metering_label.MeteringLabel`
                instance.
        :param bool ignore_missing: When set to ``False``
                    :class:`~openstack.exceptions.ResourceNotFound` will be
                    raised when the metering label does not exist.
                    When set to ``True``, no exception will be set when
                    attempting to delete a nonexistent metering label.

        :returns: ``None``
        """
        self._delete(_metering_label.MeteringLabel, metering_label,
                     ignore_missing=ignore_missing) 
开发者ID:openstack,项目名称:openstacksdk,代码行数:19,代码来源:_proxy.py

示例13: find_metering_label

# 需要导入模块: from openstack import exceptions [as 别名]
# 或者: from openstack.exceptions import ResourceNotFound [as 别名]
def find_metering_label(self, name_or_id, ignore_missing=True, **args):
        """Find a single metering label

        :param name_or_id: The name or ID of a metering label.
        :param bool ignore_missing: When set to ``False``
                    :class:`~openstack.exceptions.ResourceNotFound` will be
                    raised when the resource does not exist.
                    When set to ``True``, None will be returned when
                    attempting to find a nonexistent resource.
        :param dict args: Any additional parameters to be passed into
                          underlying methods. such as query filters.
        :returns: One :class:`~openstack.network.v2.metering_label.
                  MeteringLabel` or None
        """
        return self._find(_metering_label.MeteringLabel, name_or_id,
                          ignore_missing=ignore_missing, **args) 
开发者ID:openstack,项目名称:openstacksdk,代码行数:18,代码来源:_proxy.py

示例14: find_metering_label_rule

# 需要导入模块: from openstack import exceptions [as 别名]
# 或者: from openstack.exceptions import ResourceNotFound [as 别名]
def find_metering_label_rule(self, name_or_id, ignore_missing=True,
                                 **args):
        """Find a single metering label rule

        :param name_or_id: The name or ID of a metering label rule.
        :param bool ignore_missing: When set to ``False``
                    :class:`~openstack.exceptions.ResourceNotFound` will be
                    raised when the resource does not exist.
                    When set to ``True``, None will be returned when
                    attempting to find a nonexistent resource.
        :param dict args: Any additional parameters to be passed into
                          underlying methods. such as query filters.
        :returns: One :class:`~openstack.network.v2.metering_label_rule.
                  MeteringLabelRule` or None
        """
        return self._find(_metering_label_rule.MeteringLabelRule, name_or_id,
                          ignore_missing=ignore_missing, **args) 
开发者ID:openstack,项目名称:openstacksdk,代码行数:19,代码来源:_proxy.py

示例15: get_metering_label_rule

# 需要导入模块: from openstack import exceptions [as 别名]
# 或者: from openstack.exceptions import ResourceNotFound [as 别名]
def get_metering_label_rule(self, metering_label_rule):
        """Get a single metering label rule

        :param metering_label_rule:
            The value can be the ID of a metering label rule or a
            :class:`~openstack.network.v2.metering_label_rule.\
            MeteringLabelRule` instance.

        :returns: One
            :class:`~openstack.network.v2.metering_label_rule.\
            MeteringLabelRule`
        :raises: :class:`~openstack.exceptions.ResourceNotFound`
                 when no resource can be found.
        """
        return self._get(_metering_label_rule.MeteringLabelRule,
                         metering_label_rule) 
开发者ID:openstack,项目名称:openstacksdk,代码行数:18,代码来源:_proxy.py


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