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
This commit is contained in:
parent
c03378f034
commit
fa9c804e45
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue