This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git


The following commit(s) were added to refs/heads/master by this push:
     new 984c7ae  Tidy up remaining ES 2 configs
984c7ae is described below

commit 984c7aef6d70fe317d58ee4643780563d4773485
Author: Sebb <[email protected]>
AuthorDate: Thu Aug 20 15:49:04 2020 +0100

    Tidy up remaining ES 2 configs
---
 tools/archiver.py        | 13 -------------
 tools/plugins/elastic.py |  1 +
 2 files changed, 1 insertion(+), 13 deletions(-)

diff --git a/tools/archiver.py b/tools/archiver.py
index 0827844..ac8bc0a 100755
--- a/tools/archiver.py
+++ b/tools/archiver.py
@@ -242,15 +242,6 @@ class Archiver(object):  # N.B. Also used by import-mbox.py
         "x-mailman-rule-misses",
     ]
 
-    """ Intercept index calls and fix up consistency argument """
-
-    def index(self, **kwargs):
-        if ES_MAJOR in [6, 7]:
-            if kwargs.pop("consistency", None):  # drop the key if present
-                if self.wait_for_active_shards:  # replace with wait if defined
-                    kwargs["wait_for_active_shards"] = 
self.wait_for_active_shards
-        return self.elastic.index(**kwargs)
-
     def __init__(self, generator=archiver_generator, parse_html=False, 
dump_dir=None):
         """ Just initialize ES. """
         self.html = parse_html
@@ -500,14 +491,12 @@ class Archiver(object):  # N.B. Also used by 
import-mbox.py
             self.index(
                 index=self.elastic.db_mbox,
                 id=ojson["mid"],
-                consistency=self.consistency,
                 body=ojson,
             )
 
             self.index(
                 index=self.elastic.db_source,
                 id=sha3,
-                consistency=self.consistency,
                 body={
                     "message-id": msg_metadata["message-id"],
                     "permalink": ojson["mid"],
@@ -555,7 +544,6 @@ class Archiver(object):  # N.B. Also used by import-mbox.py
             self.elastic.index(
                 index=self.elastic.db_mailinglist,
                 id=lid,
-                consistency=self.elastic.consistency,
                 body={
                     "list": lid,
                     "name": mlist.list_name,
@@ -581,7 +569,6 @@ class Archiver(object):  # N.B. Also used by import-mbox.py
                         # N.B. no index is supplied, so ES will generate one
                         self.index(
                             index=self.elastic.db_notification,
-                            consistency=self.elastic.consistency,
                             body={
                                 "type": "direct",
                                 "recipient": cid,
diff --git a/tools/plugins/elastic.py b/tools/plugins/elastic.py
index 5b2421c..ffbf194 100755
--- a/tools/plugins/elastic.py
+++ b/tools/plugins/elastic.py
@@ -133,6 +133,7 @@ class Elastic:
         return self.es.search(index=self.dbname, **kwargs)
 
     def index(self, **kwargs):
+        kwargs["wait_for_active_shards"] = self.wait_for_active_shards
         return self.es.index(**kwargs)
 
     def update(self, **kwargs):

Reply via email to