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


Python uuidutils.is_uuid_like函数代码示例

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


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

示例1: _handler

    def _handler(self, client_sock, client_addr):
        """Handle incoming lease relay stream connection.

        This method will only read the first 1024 bytes and then close the
        connection.  The limit exists to limit the impact of misbehaving
        clients.
        """
        try:
            msg = client_sock.recv(1024)
            data = jsonutils.loads(msg)
            client_sock.close()

            network_id = data['network_id']
            if not uuidutils.is_uuid_like(network_id):
                raise ValueError(_("Network ID %s is not a valid UUID") %
                                 network_id)
            ip_address = str(netaddr.IPAddress(data['ip_address']))
            lease_remaining = int(data['lease_remaining'])
            self.callback(network_id, ip_address, lease_remaining)
        except ValueError as e:
            LOG.warn(_('Unable to parse lease relay msg to dict.'))
            LOG.warn(_('Exception value: %s'), e)
            LOG.warn(_('Message representation: %s'), repr(msg))
        except Exception as e:
            LOG.exception(_('Unable update lease. Exception'))
开发者ID:alanmeadows,项目名称:quantum,代码行数:25,代码来源:dhcp_agent.py

示例2: _validate_uuid

def _validate_uuid(data, valid_values=None):
    if uuidutils.is_uuid_like(data):
        return
    else:
        msg = _("%s is not a valid UUID") % data
        LOG.debug("validate_uuid: %s", msg)
        return msg
开发者ID:dprince,项目名称:quantum,代码行数:7,代码来源:attributes.py

示例3: convert_to_uuid_list_or_none

def convert_to_uuid_list_or_none(value_list):
    if value_list is None:
        return
    for sg_id in value_list:
        if not uuidutils.is_uuid_like(sg_id):
            msg = _("'%s' is not an integer or uuid") % sg_id
            raise qexception.InvalidInput(error_message=msg)
    return value_list
开发者ID:citrix-openstack,项目名称:neutron,代码行数:8,代码来源:securitygroup.py

示例4: convert_to_uuid_or_int_list

def convert_to_uuid_or_int_list(value_list):
    if value_list is None:
        return
    try:
        return [sg_id if uuidutils.is_uuid_like(sg_id) else int(sg_id)
                for sg_id in value_list]
    except (ValueError, TypeError):
        msg = _("'%s' is not an integer or uuid") % sg_id
        raise qexception.InvalidInput(error_message=msg)
开发者ID:wdec,项目名称:quantum,代码行数:9,代码来源:securitygroup.py

示例5: _get_security_group_rule

 def _get_security_group_rule(self, context, id):
     try:
         if uuidutils.is_uuid_like(id):
             query = self._model_query(context, SecurityGroupRule)
             sgr = query.filter(SecurityGroupRule.id == id).one()
         else:
             query = self._model_query(context, SecurityGroupRule)
             sgr = query.filter(SecurityGroupRule.external_id == id).one()
     except exc.NoResultFound:
         raise ext_sg.SecurityGroupRuleNotFound(id=id)
     return sgr
开发者ID:a3linux,项目名称:quantum,代码行数:11,代码来源:securitygroups_db.py

示例6: existing_dhcp_networks

    def existing_dhcp_networks(cls, conf, root_helper):
        """Return a list of existing networks ids (ones we have configs for)"""

        confs_dir = os.path.abspath(os.path.normpath(conf.dhcp_confs))

        class FakeNetwork:
            def __init__(self, net_id):
                self.id = net_id

        return [
            c for c in os.listdir(confs_dir)
            if (uuidutils.is_uuid_like(c) and
                cls(conf, FakeNetwork(c), root_helper).active)
        ]
开发者ID:NCU-PDCLAB,项目名称:quantum,代码行数:14,代码来源:dhcp.py

示例7: _validate_uuid

def _validate_uuid(data, valid_values=None):
    if not uuidutils.is_uuid_like(data):
        msg = _("'%s' is not a valid UUID") % data
        LOG.debug(msg)
        return msg
开发者ID:wallnerryan,项目名称:quantum_migrate,代码行数:5,代码来源:attributes.py


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