def check_for_broken_proxy()

in rabbitmq/transcode_check.py [0:0]


def check_for_broken_proxy(vsid):
    """
    check whether the given item id has a "broken" proxy, i.e. a lowres shape on it with no data.
    a valid shape should have a "containerComponent" on it.
    if there is no lowres shape present, then True is also returned
    :param vsid:
    :return: a boolean indicating whether the proxy should be regenrated and the shape ID of the proxy or None
    """
    for shape_id in list_shape_ids(vsid):
        shapeinfo = check_shape_tag(vsid, shape_id, "lowres")
        if shapeinfo is not None:
            #we have the lowres shape
            container_component_node = shapeinfo.find("{0}containerComponent".format(xmlns))
            if container_component_node is None:
                logger.warning("{0}: item has an invalid proxy".format(vsid))
                return True, shape_id
            else:
                logger.info("{0}: item has a valid proxy".format(vsid))
                return False, shape_id

    logger.error("{0}: item has no proxy at all!".format(vsid))
    return True, None