flant / curator-opensearch

Curator for OpenSearch.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

restore report state fails

eyalc10 opened this issue · comments

Issue:
action.yaml file,
restore action,
indices ['xxx*']

  • self.expected_output equals to a regex as a string ("xxx*")
  • therefore - the foollwing error message is received:
    'Some of the indices do not appear to have been restored. Missing: "xxx*"'

class Restore(object):
...
report_state function

In order to fix the issue - I have added the following code before the "for" statement:

        for chunk in utils.chunk_index_list(self.expected_output):
            try:
                chunk_response = self.client.indices.recovery(index=chunk, human=True)
            except Exception as err:
                raise exceptions.CuratorException(
                    'Unable to obtain recovery information for specified indices. '
                    'Error: {0}'.format(err)
                )
            # This should address #962, where perhaps the cluster state hasn't yet
            # had a chance to add a _recovery state yet, so it comes back empty.
            if chunk_response == {}:
                self.loggit.info('_recovery returned an empty response. Trying again.')
                return False
            response.update(chunk_response)
            self.loggit.info('eyalc: report_state Found indices: {0}'.format(list(response.keys())))

        self.expected_output = response.keys()

@eyalc10 : Hello.

  1. Please provide me a complete action.yaml and outputs of /_cat/indices and _cat/snapshots/repo-name/
  2. Can you prepare a PR with your changes?

Fixed in #30