def _meta_get_ilm_lifecycle_data()

in src/es_pii_tool/helpers/steps.py [0:0]


def _meta_get_ilm_lifecycle_data(var: DotMap, data: DotMap) -> str:
    """Make a metastep for get_ilm_lifecycle_data"""
    response = ''
    if data.index.lifecycle.name:
        res = api.get_ilm_lifecycle(var.client, data.index.lifecycle.name)
        if not res:
            msg = f'No such ILM policy: {data.index.lifecycle.name}'
            raise BadClientResult(msg, Exception())
        data.ilm.lifecycle = DotMap(res[data.index.lifecycle.name])
        response = f'ILM lifecycle settings: {data.ilm.lifecycle}'
    else:
        response = f'Index {var.index} has no ILM lifecycle data'
    logger.debug(response)
    return response