From fa9c804e4597b6189c3baad15d2d7a33754262ca Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Mon, 3 Oct 2016 14:50:43 -0400 Subject: [PATCH] Fix elasticsearch querying with recent e-r changes A recent elastic-recheck commit, change Ic6f115a6882494bf4c087ded4d7cafa557765c28 made backwards incompatible changes to the api for the classfier object to use a common config object. This was a good cleanup but failed to account for things reusing elastic-recheck as a lib interface outside of the repo (like openstack-health). This change refactors the openstack-health usage to take into account these recent changes and unbreak things. Change-Id: I3afe7f0a4a4475084be54f8df69083105fb4a4fe --- openstack_health/api.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/openstack_health/api.py b/openstack_health/api.py index ca8e5e33..785d7bd1 100644 --- a/openstack_health/api.py +++ b/openstack_health/api.py @@ -44,6 +44,7 @@ from openstack_health.run_aggregator import RunAggregator from openstack_health import test_run_aggregator try: + from elastic_recheck import config as er_config from elastic_recheck import elasticRecheck as er except ImportError: er = None @@ -107,8 +108,9 @@ def setup(): global es_url es_url = _config_get(config.get, 'default', 'es_url', None) if query_dir and er: + elastic_config = er_config.Config(es_url=es_url) global classifier - classifier = er.Classifier(query_dir, es_url=es_url) + classifier = er.Classifier(query_dir, config=elastic_config) # Cache Configuration backend = _config_get(config.get, 'default', 'cache_backend', 'dogpile.cache.dbm') @@ -631,7 +633,7 @@ def _check_er_availability(): elif not es_url or not query_dir: health = 'NotConfigured' else: - url = classifier.es_url + url = classifier.config.es_url es = pyelasticsearch.ElasticSearch(url) health = {'Configured': {'elastic-search': es.health()['status']}} return health