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)
评论列表
文章目录