in curator/actions/snapshot.py [0:0]
def do_action(self):
"""
:py:meth:`elasticsearch.client.SnapshotClient.create` a snapshot of
:py:attr:`indices`, with passed parameters.
"""
if not self.skip_repo_fs_check:
verify_repository(self.client, self.repository)
if snapshot_running(self.client):
raise SnapshotInProgress('Snapshot already in progress.')
try:
self.loggit.info(
'Creating snapshot "%s" from indices: %s',
self.name,
self.index_list.indices,
)
# 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.create(
repository=self.repository,
snapshot=self.name,
ignore_unavailable=self.ignore_unavailable,
include_global_state=self.include_global_state,
indices=self.indices,
partial=self.partial,
wait_for_completion=False,
)
if self.wait_for_completion:
wait_for_it(
self.client,
'snapshot',
snapshot=self.name,
repository=self.repository,
wait_interval=self.wait_interval,
max_wait=self.max_wait,
)
self.report_state()
else:
msg = (
f'"wait_for_completion" set to {self.wait_for_completion}. '
f'Remember to check for successful completion manually.'
)
self.loggit.warning(msg)
except Exception as err:
report_failure(err)