diff options
Diffstat (limited to 'sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_2_create_resources_template.rb')
-rw-r--r-- | sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_2_create_resources_template.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_2_create_resources_template.rb b/sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_2_create_resources_template.rb index d35b81293e..11b8c9d060 100644 --- a/sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_2_create_resources_template.rb +++ b/sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_2_create_resources_template.rb @@ -1,8 +1,11 @@ +# Get the first es node in the list +es_node = node['Nodes']['ES'].first + ruby_block "check_ElasticSearch_Cluster_Health" do block do #tricky way to load this Chef::Mixin::ShellOut utilities Chef::Resource::RubyBlock.send(:include, Chef::Mixin::ShellOut) - curl_command = "http://#{node['Nodes']['ES']}:9200/_cluster/health?pretty=true" + curl_command = "http://#{es_node}:9200/_cluster/health?pretty=true" resp = Net::HTTP.get_response URI.parse(curl_command) stat = JSON.parse(resp.read_body)['status'] @@ -32,6 +35,6 @@ bash "create resources mapping" do "_all": { "enabled": true } } } - }' http://#{node['Nodes']['ES']}:9200/_template/resources_template + }' http://#{es_node}:9200/_template/resources_template EOH end
\ No newline at end of file |