Skip to content

Commit e23009b

Browse files
author
Jeff Kramer
committed
fails cleanly if root node is unavailable
1 parent 1eba68c commit e23009b

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

elasticsearch/python_modules/elasticsearch.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,10 @@ def metric_init(params):
187187

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

190-
result = json.load(urllib.urlopen(host))
190+
try:
191+
result = json.load(urllib.urlopen(host))
192+
except (ValueError, IOError):
193+
result = {}
191194

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

0 commit comments

Comments
 (0)