ponymail-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject incubator-ponymail git commit: Bug: import-mbox should not check database during a dry run
Date Tue, 26 Sep 2017 11:37:34 GMT
Repository: incubator-ponymail
Updated Branches:
  refs/heads/master f7a5aacfd -> 57e72f9df


Bug: import-mbox should not check database during a dry run

This fixes #413

Project: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/commit/57e72f9d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/tree/57e72f9d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/diff/57e72f9d

Branch: refs/heads/master
Commit: 57e72f9dfcf001ab511a9bf0ec33de1e659adc36
Parents: f7a5aac
Author: Sebb <sebb@apache.org>
Authored: Tue Sep 26 12:37:31 2017 +0100
Committer: Sebb <sebb@apache.org>
Committed: Tue Sep 26 12:37:31 2017 +0100

----------------------------------------------------------------------
 tools/import-mbox.py | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/57e72f9d/tools/import-mbox.py
----------------------------------------------------------------------
diff --git a/tools/import-mbox.py b/tools/import-mbox.py
index 9eb5bd4..c983f80 100755
--- a/tools/import-mbox.py
+++ b/tools/import-mbox.py
@@ -471,19 +471,17 @@ print("Checking that the database index %s exists ... " % dbname)
 # elasticsearch logs lots of warnings on retries/connection failure
 import logging
 logging.getLogger("elasticsearch").setLevel(logging.ERROR)
-try:
-    if not es.indices.exists(dbname):
-        print("Error: the index '%s' does not exist!" % (dbname))
-        if args.dry:
-            print("Dry-run; continuing to check input data")
-        else:
+
+if args.dry:
+    print("Dry-run; continuing to check input data")
+else:
+    try:
+        if not es.indices.exists(dbname):
+            print("Error: the index '%s' does not exist!" % (dbname))
             sys.exit(1)
-    print("Database exists OK")
-except Exception as err:
-    print("Error: unable to check if the index %s exists!: %s" % (dbname, err))
-    if args.dry:
-        print("Dry-run; continuing to check input data")
-    else:
+        print("Database exists OK")
+    except Exception as err:
+        print("Error: unable to check if the index %s exists!: %s" % (dbname, err))
         sys.exit(1)
 
 


Mime
View raw message