in curator/actions/snapshot.py [0:0]
def do_action(self):
"""
:py:meth:`~.elasticsearch.client.SnapshotClient.restore` :py:attr:`indices` from
:py:attr:`name` with passed params.
"""
if not self.skip_repo_fs_check:
verify_repository(self.client, self.repository)
if snapshot_running(self.client):
raise SnapshotInProgress('Cannot restore while a snapshot is in progress.')
try:
self.loggit.info(
'Restoring indices "%s" from snapshot: %s', self.indices, self.name
)
# Always set wait_for_completion to False. Let 'wait_for_it' do its
# thing if wait_for_completion is set to True. Report the task_id
# either way.
self.client.snapshot.restore(
repository=self.repository,
snapshot=self.name,
ignore_index_settings=None,
ignore_unavailable=self.ignore_unavailable,
include_aliases=self.include_aliases,
include_global_state=self.include_global_state,
index_settings=self.index_settings,
indices=self.indices,
partial=self.partial,
rename_pattern=self.rename_pattern,
rename_replacement=self.rename_replacement,
wait_for_completion=False,
)
if self.wfc:
wait_for_it(
self.client,
'restore',
index_list=self.expected_output,
wait_interval=self.wait_interval,
max_wait=self.max_wait,
)
self.report_state()
else:
msg = (
f'"wait_for_completion" set to {self.wfc}. '
f'Remember to check for successful completion manually.'
)
self.loggit.warning(msg)
except Exception as err:
report_failure(err)