in curator/actions/cold2frozen.py [0:0]
def action_generator(self):
"""Yield a dict for use in :py:meth:`do_action` and :py:meth:`do_dry_run`
:returns: A generator object containing the settings necessary to migrate
indices from cold to frozen
:rtype: dict
"""
for idx in self.index_list.indices:
idx_settings = meta_getter(self.client, idx, get='settings')
self.loggit.debug('Index %s has settings: %s', idx, idx_settings)
if has_lifecycle_name(idx_settings):
self.loggit.critical(
'Index %s is associated with an ILM policy and this action '
'will never work on an index associated with an ILM policy',
idx,
)
raise CuratorException(f'Index {idx} is associated with an ILM policy')
if is_idx_partial(idx_settings):
self.loggit.critical('Index %s is already in the frozen tier', idx)
raise SearchableSnapshotException('Index is already in frozen tier')
snap = idx_settings['store']['snapshot']['snapshot_name']
snap_idx = idx_settings['store']['snapshot']['index_name']
repo = idx_settings['store']['snapshot']['repository_name']
msg = (
f'Index {idx} Snapshot name: {snap}, Snapshot index: {snap_idx}, '
f'repo: {repo}'
)
self.loggit.debug(msg)
aliases = meta_getter(self.client, idx, get='alias')
renamed = f'partial-{idx}'
if not self.index_settings:
self.index_settings = {
"routing": {
"allocation": {
"include": {
"_tier_preference": get_tier_preference(self.client)
}
}
}
}
yield {
'repository': repo,
'snapshot': snap,
'index': snap_idx,
'renamed_index': renamed,
'index_settings': self.index_settings,
'ignore_index_settings': self.ignore_index_settings,
'storage': 'shared_cache',
'wait_for_completion': self.wait_for_completion,
'aliases': aliases,
'current_idx': idx,
}