Skip to content

Commit

Permalink
Bail out early if cluster state cannot be determined
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Keith committed Feb 9, 2018
1 parent df16a93 commit 9e02598
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 9e02598

Please sign in to comment.