Skip to content

Commit

Permalink
Merge pull request #56 from signalfx/error-handling
Browse files Browse the repository at this point in the history
Bail out early if cluster state cannot be determined
  • Loading branch information
molner authored Feb 9, 2018
2 parents df16a93 + 9e02598 commit b2e5302
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '2'
jobs:
build:
docker:
- image: ubuntu:yakkety
- image: ubuntu:xenial
working_directory: ~/code
steps:
- setup_remote_docker
Expand Down
4 changes: 4 additions & 0 deletions elasticsearch_collectd.py
Original file line number Diff line number Diff line change
Expand Up @@ -1019,6 +1019,10 @@ def detect_es_master(self):
cluster_state = self.fetch_url(self.es_url_scheme + "://" +
self.es_host + ":" + str(self.es_port) +
"/_cluster/state/master_node")
if cluster_state is None:
self.es_current_master = False
return

if self.es_current_master is False \
and cluster_state['master_node'] == self.node_id:
self.es_current_master = True
Expand Down

0 comments on commit b2e5302

Please sign in to comment.