ponymail-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject [incubator-ponymail] branch master updated: Don't fail engineVersion if cannot connect
Date Sat, 26 May 2018 12:06:22 GMT
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.git


The following commit(s) were added to refs/heads/master by this push:
     new 35e4004  Don't fail engineVersion if cannot connect
35e4004 is described below

commit 35e40047f9e5a9d43f244c7b59c06c55c8a0763e
Author: Sebb <sebb@apache.org>
AuthorDate: Sat May 26 13:06:20 2018 +0100

    Don't fail engineVersion if cannot connect
---
 tools/elastic.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/tools/elastic.py b/tools/elastic.py
index 565dfc2..9ca1cd0 100755
--- a/tools/elastic.py
+++ b/tools/elastic.py
@@ -26,7 +26,7 @@ import logging
 import certifi
 
 try:
-    from elasticsearch import Elasticsearch, helpers
+    from elasticsearch import Elasticsearch, helpers, ElasticsearchException
     from elasticsearch import VERSION as ES_VERSION
 except ImportError as e:
     sys.exit("Sorry, you need to install the elasticsearch module from pip first. (%s)" %
str(e))
@@ -74,7 +74,11 @@ class Elastic:
 
     def engineVersion(self):
         if not self.dbVersion:
-            self.dbVersion = self.info()['version']['number']
+            try:
+                self.dbVersion = self.info()['version']['number']
+            except ElasticsearchException:
+                # default if cannot connect; allows retry
+                return '0.0.0'
         return self.dbVersion
     def engineMajor(self):
         return int(self.engineVersion().split('.')[0])

-- 
To stop receiving notification emails like this one, please contact
sebb@apache.org.

Mime
View raw message