From c0ab5af784bb46902c68169b0c5486018748caac Mon Sep 17 00:00:00 2001 From: genevera Date: Sun, 7 Apr 2019 23:14:29 -0400 Subject: [PATCH] code golf --- curator/actions.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/curator/actions.py b/curator/actions.py index 3f8d7d9f..67264586 100644 --- a/curator/actions.py +++ b/curator/actions.py @@ -2156,11 +2156,13 @@ def do_action(self): self.loggit.info('Shrinking index "{0}" to "{1}" with settings: {2}, wait_for_active_shards={3}'.format(idx, target, self.body, self.wait_for_active_shards)) try: + self.client.indices.shrink(index=idx, params=self.shrink_copy_settings, target=target, body=self.body, wait_for_active_shards=self.wait_for_active_shards) - self.loggit.debug('unblocking writes on {0}'.format(target)) - self._unblock_writes(target) - self.loggit.debug('undoing route reqs for {0}'.format(target)) - self.route_index(target, 'require', '_name', '') + if utils.get_version(self.client) >= (6,4,3): + self.loggit.debug('unblocking writes on {0}'.format(target)) + self._unblock_writes(target) + self.loggit.debug('undoing route reqs for {0}'.format(target)) + self.route_index(target, 'require', '_name', '') # Wait for it to complete if self.wfc: self.loggit.debug('Wait for shards to complete allocation for index: {0}'.format(target))