pcmk.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:charm-hacluster 作者: openstack 项目源码 文件源码
def get_property(name):
    """Retrieve a cluster's property

    :param name: property name
    :returns: property value
    :rtype: str
    """
    # crmsh >= 2.3 renamed show-property to get-property, 2.3.x is
    # available since zesty
    if crm_version() >= StrictVersion('2.3.0'):
        output = subprocess.check_output(['crm', 'configure',
                                          'get-property', name],
                                         universal_newlines=True)
    elif crm_version() < StrictVersion('2.2.0'):
        # before 2.2.0 there is no method to get a property
        output = subprocess.check_output(['crm', 'configure', 'show', 'xml'],
                                         universal_newlines=True)
        return get_property_from_xml(name, output)
    else:
        output = subprocess.check_output(['crm', 'configure',
                                          'show-property', name],
                                         universal_newlines=True)

    return output
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号