in curator/actions/replicas.py [0:0]
def do_action(self):
"""
Update ``number_of_replicas`` with :py:attr:`count` and
:py:meth:`~.elasticsearch.client.IndicesClient.put_settings` to indices in
:py:attr:`index_list`
"""
self.loggit.debug(
'Cannot get update replica count of closed indices. Omitting any '
'closed indices.'
)
self.index_list.filter_closed()
self.index_list.empty_list_check()
msg = (
f'Setting the replica count to {self.count} for '
f'{len(self.index_list.indices)} indices: {self.index_list.indices}'
)
self.loggit.info(msg)
try:
index_lists = chunk_index_list(self.index_list.indices)
for lst in index_lists:
self.client.indices.put_settings(
index=to_csv(lst), settings={'number_of_replicas': self.count}
)
if self.wfc and self.count > 0:
msg = (
f'Waiting for shards to complete replication for indices: '
f'{to_csv(lst)}'
)
self.loggit.debug(msg)
wait_for_it(
self.client,
'replicas',
wait_interval=self.wait_interval,
max_wait=self.max_wait,
)
# pylint: disable=broad-except
except Exception as err:
report_failure(err)