You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kibble.apache.org by hu...@apache.org on 2019/06/11 00:57:51 UTC

[kibble] 01/02: Refactor detection of ES version, store in accessible variable

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

humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kibble.git

commit 504882e8dff69c0a73ba849fcdd6fb0ddca70ac4
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Tue Jun 11 02:57:13 2019 +0200

    Refactor detection of ES version, store in accessible variable
---
 api/plugins/database.py | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/api/plugins/database.py b/api/plugins/database.py
index 0401ae1..80b94dd 100644
--- a/api/plugins/database.py
+++ b/api/plugins/database.py
@@ -121,10 +121,9 @@ class KibbleDatabase(object):
         # IMPORTANT BIT: Figure out if this is ES < 6.x, 6.x or >= 7.x.
         # If so, we're using the new ES DB mappings, and need to adjust ALL
         # ES calls to match this.
-        es6 = True if int(self.ES.info()['version']['number'].split('.')[0]) >= 6 else False
-        es7 = True if int(self.ES.info()['version']['number'].split('.')[0]) >= 7 else False
-        if es7:
+        self.ESversion = int(self.ES.info()['version']['number'].split('.')[0])
+        if self.ESversion >= 7:
             self.ES = KibbleESWrapperSeven(self.ES)
-        elif es6:
+        elif self.ESVersion >= 6:
             self.ES = KibbleESWrapper(self.ES)