in src/es_pii_tool/helpers/steps.py [0:0]
def apply_ilm_policy(task: 'Task', stepname, var: DotMap, **kwargs) -> None:
"""
If the index was associated with an ILM policy, associate it with the
new, cloned ILM policy.
"""
missing_data(stepname, kwargs)
data = kwargs['data']
if data.new.ilmname:
settings = {'index': {}} # type: ignore
# Add all of the original lifecycle settings
settings['index']['lifecycle'] = data.index.lifecycle.toDict()
# Replace the name with the new ILM policy name
settings['index']['lifecycle']['name'] = data.new.ilmname
drm = f'Apply new ILM policy {data.new.ilmname} to {var.mount_name}'
metastep(
task,
stepname,
api.put_settings,
var.client,
var.mount_name,
settings,
dry_run_msg=drm,
)