Skip to content

Commit

Permalink
Merge pull request #55 from signalfx/check-version-compatibility
Browse files Browse the repository at this point in the history
Handle deprecated 'settings' field in json
  • Loading branch information
molner authored Nov 7, 2017
2 parents 3c03055 + 73bf144 commit df16a93
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions elasticsearch_collectd.py
Original file line number Diff line number Diff line change
Expand Up @@ -993,10 +993,14 @@ def load_es_info(self):
node_info = json['nodes'].itervalues().next()
version = node_info['version']
# a node is master eligible by default unless it's configured otherwise
# Note: settings is deprecated from json starting ES 5.5
master_eligible = True
if 'node' in node_info['settings'] and \
'master' in node_info['settings']['node']:
master_eligible = node_info['settings']['node']['master'] == 'true'
try:
if 'node' in node_info['settings'] and \
'master' in node_info['settings']['node']:
master_eligible = node_info['settings']['node']['master'] == 'true'
except KeyError:
pass

# update settings
self.es_master_eligible = master_eligible
Expand Down

0 comments on commit df16a93

Please sign in to comment.