helpers.py 文件源码

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

项目:service-fabric-cli 作者: Azure 项目源码 文件源码
def parse_service_type(xml_file):
    """Determines the first avaliable service type and the associated
    type name"""
    root = ET.parse(xml_file).getroot()
    service_type = root.find('fabric:ServiceTypes', XML_NS)
    if service_type is None:
        raise ValueError('Could not find service types in service manifest')
    service_type_kind = None
    if 'StatelessServiceType' in service_type[0].tag:
        service_type_kind = 'stateless'
    else:
        # For now we only support stateless services for service creation
        raise ValueError('Unsupported service type')
    service_type_name = service_type[0].attrib.get('ServiceTypeName', None)
    if not service_type_name:
        raise ValueError('Could not find service type name')

    return (service_type_kind, service_type_name)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号