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


Python Bundle.valid方法代码示例

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


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

示例1: load_consumer_id

# 需要导入模块: from pulp.common.bundle import Bundle [as 别名]
# 或者: from pulp.common.bundle.Bundle import valid [as 别名]
def load_consumer_id(context):
    """
    Returns the consumer's ID if it is registered.

    @return: consumer id if registered; None when not registered
    @rtype:  str, None
    """
    filesystem_section = context.config.get('filesystem', None)
    if filesystem_section is None:
        return None

    consumer_cert_path = filesystem_section.get('id_cert_dir', None)
    consumer_cert_filename = filesystem_section.get('id_cert_filename', None)

    if None in (consumer_cert_path, consumer_cert_filename):
        return None

    full_filename = os.path.join(consumer_cert_path, consumer_cert_filename)
    bundle = Bundle(full_filename)

    if not bundle.valid():
        return None

    content = bundle.read()
    x509 = X509.load_cert_string(content)
    subject = _subject(x509)
    return subject['CN']
开发者ID:AndreaGiardini,项目名称:pulp,代码行数:29,代码来源:consumer_utils.py

示例2: load_consumer_id

# 需要导入模块: from pulp.common.bundle import Bundle [as 别名]
# 或者: from pulp.common.bundle.Bundle import valid [as 别名]
def load_consumer_id(context):
    """
    Returns the consumer's ID if it is registered.

    @return: consumer id if registered; None when not registered
    @rtype:  str, None
    """
    consumer_cert_path = context.config['filesystem']['id_cert_dir']
    consumer_cert_filename = context.config['filesystem']['id_cert_filename']
    full_filename = os.path.join(consumer_cert_path, consumer_cert_filename)
    bundle = Bundle(full_filename)
    if bundle.valid():
        content = bundle.read()
        x509 = X509.load_cert_string(content)
        subject = _subject(x509)
        return subject['CN']
    else:
        return None
开发者ID:ehelms,项目名称:pulp,代码行数:20,代码来源:consumer_utils.py


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