You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kibble.apache.org by tu...@apache.org on 2020/12/13 02:10:27 UTC

[kibble] branch main updated: Fix error when running Kibble Scanner (#109)

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

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


The following commit(s) were added to refs/heads/main by this push:
     new d9a3893  Fix error when running Kibble Scanner (#109)
d9a3893 is described below

commit d9a3893d660517ee705948e0fbcf13c5ce1578a4
Author: Kaxil Naik <ka...@gmail.com>
AuthorDate: Sun Dec 13 02:10:18 2020 +0000

    Fix error when running Kibble Scanner (#109)
---
 kibble/scanners/brokers/kibbleES.py | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/kibble/scanners/brokers/kibbleES.py b/kibble/scanners/brokers/kibbleES.py
index 5792dd8..472afe5 100644
--- a/kibble/scanners/brokers/kibbleES.py
+++ b/kibble/scanners/brokers/kibbleES.py
@@ -335,18 +335,21 @@ class Broker:
         apidoc = es.get(index=es_config["database"], doc_type="api", id="current")[
             "_source"
         ]
+        apidoc_db_version = int(apidoc["dbversion"])
         # We currently accept and know how to use DB versions 1 and 2.
-        if apidoc["dbversion"] not in ACCEPTED_DB_VERSIONS:
-            if apidoc["dbversion"] > KIBBLE_DB_VERSION:
+        if apidoc_db_version not in ACCEPTED_DB_VERSIONS:
+            if apidoc_db_version > KIBBLE_DB_VERSION:
                 sys.stderr.write(
-                    "The database '%s' uses a newer structure format (version %u) than the scanners (version %u). Please upgrade your scanners.\n"
-                    % (es_config["database"], apidoc["dbversion"], KIBBLE_DB_VERSION)
+                    "The database '%s' uses a newer structure format (version %u) than the scanners "
+                    "(version %u). Please upgrade your scanners.\n"
+                    % (es_config["database"], apidoc_db_version, KIBBLE_DB_VERSION)
                 )
                 sys.exit(-1)
-            if apidoc["dbversion"] < KIBBLE_DB_VERSION:
+            if apidoc_db_version < KIBBLE_DB_VERSION:
                 sys.stderr.write(
-                    "The database '%s' uses an older structure format (version %u) than the scanners (version %u). Please upgrade your main Kibble server.\n"
-                    % (es_config["database"], apidoc["dbversion"], KIBBLE_DB_VERSION)
+                    "The database '%s' uses an older structure format (version %u) than the scanners "
+                    "(version %u). Please upgrade your main Kibble server.\n"
+                    % (es_config["database"], apidoc_db_version, KIBBLE_DB_VERSION)
                 )
                 sys.exit(-1)