Skip to content

Commit

Permalink
fails cleanly if root node is unavailable
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Kramer committed Jul 17, 2015
1 parent 1eba68c commit e23009b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion elasticsearch/python_modules/elasticsearch.py
Expand Up @@ -187,7 +187,10 @@ def metric_init(params):

host = params.get('host', 'http://localhost:9200/')

result = json.load(urllib.urlopen(host))
try:
result = json.load(urllib.urlopen(host))
except (ValueError, IOError):
result = {}

host_version = result.get('version',{}).get('number') or "1.2"
version = params.get('version', host_version)
Expand Down

0 comments on commit e23009b

Please sign in to comment.