Skip to content

Commit a3144d6

Browse files
authored
Merge pull request #14 from objectrocket/es_5_fixes
quick fix for node roles in ES5
2 parents ea48df6 + 8ccce0d commit a3144d6

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

elasticstat/elasticstat.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -195,14 +195,15 @@ def get_disk_usage(self, node_fs_stats):
195195
return "{}|{}%".format(used_human, used_percent)
196196

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

204-
if attributes is not None:
203+
if attributes is not None and roles is None:
205204
# pre-2.3 roles
205+
ismaster = 'true'
206+
isdata = 'true'
206207
isingest = 'false'
207208
if 'data' in attributes:
208209
isdata = attributes['data']

0 commit comments

Comments
 (0)