Skip to content

Commit

Permalink
Merge pull request #282 from opsline/281-environment-agent-search
Browse files Browse the repository at this point in the history
agent should search for opscode server in its own environment
  • Loading branch information
michaelklishin committed May 15, 2016
2 parents d9ba305 + 7ba2b9b commit f70f619
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion recipes/opscenter_agent_datastax.rb
Expand Up @@ -25,7 +25,8 @@
unless server_ip && !node['cassandra']['opscenter']['agent']['use_chef_search']

unless Chef::Config[:solo]
search_results = search(:node, "roles:#{node['cassandra']['opscenter']['agent']['server_role']}")
search_results = search(:node, "chef_environment:#{node.chef_environment} "\
"AND roles:#{node['cassandra']['opscenter']['agent']['server_role']}")
if !search_results.empty?
server_ip = search_results[0]['ipaddress']
else
Expand Down
3 changes: 2 additions & 1 deletion recipes/opscenter_agent_tarball.rb
Expand Up @@ -30,7 +30,8 @@
unless server_ip && !node['cassandra']['opscenter']['agent']['use_chef_search']

unless Chef::Config[:solo]
search_results = search(:node, "roles:#{node['cassandra']['opscenter']['agent']['server_role']}")
search_results = search(:node, "chef_environment:#{node.chef_environment} "\
"AND roles:#{node['cassandra']['opscenter']['agent']['server_role']}")
if !search_results.empty?
server_ip = search_results[0]['ipaddress']
else
Expand Down

0 comments on commit f70f619

Please sign in to comment.