Skip to content

Commit

Permalink
Merge pull request #14 from objectrocket/es_5_fixes
Browse files Browse the repository at this point in the history
quick fix for node roles in ES5
  • Loading branch information
evanfreed authored Nov 9, 2016
2 parents ea48df6 + 8ccce0d commit a3144d6
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions elasticstat/elasticstat.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,14 +195,15 @@ def get_disk_usage(self, node_fs_stats):
return "{}|{}%".format(used_human, used_percent)

def get_role(self, attributes=None, roles=None):
# This is dumb, but if data/master is true, ES doesn't include the key in
# the attributes subdoc. Why?? :-P
ismaster = 'true'
isdata = 'true'
isingest = 'true'
# TODO: A bit of a hack I'm not proud of
ismaster = 'false'
isdata = 'false'
isingest = 'false'

if attributes is not None:
if attributes is not None and roles is None:
# pre-2.3 roles
ismaster = 'true'
isdata = 'true'
isingest = 'false'
if 'data' in attributes:
isdata = attributes['data']
Expand Down

0 comments on commit a3144d6

Please sign in to comment.