[chef] Re: Re: Re: Re: search returns for nodes sometimes reduced or empty


Chronological Thread 
  • From: Dan Adams < >
  • To: < >
  • Subject: [chef] Re: Re: Re: Re: search returns for nodes sometimes reduced or empty
  • Date: Wed, 06 Jun 2012 18:17:38 +0100
  • Mail-reply-to: < >

Hi Zac

Thanks for your reply, you've been very helpful.

On 06.06.2012 16:30, Zac Stevens wrote:
I may have been unclear in my question - sorry if below I repeat
something you already know.
When you are searching, what is your search query?  Are you searching
for "roles:yourrole" or something else?

I have been using something along the lines of this:
search(:node, "chef_environment:#{node['chef_environment']} AND role:xyz")

as given here on the manual:
http://wiki.opscode.com/display/chef/Search#Search-FindNodeswithaRoleintheRunList

in my recipes to return a list of nodes with the given environment and role. However, I'm guessing that you are telling me that there are two ways to search for role, one of which supplies the roles assigned to the node in its config as imported, and the other that is dynamically updated based on the outcome of the last run? I am very much looking to return the former via search - a permanent value that is correct regardless of the outcome of the last client run, and that is never null or empty.

Say I have a role called "physical-server".  This search will only
find nodes that have role[physical-server] on their run_list, and have
successfully run and saved their state back to the server:

 knife search node "roles:physical-server"

On the other hand, this search will find all nodes with that item on
their run_list, whether they have had a successful run or not:

 knife search node "run_list:role\[physical-server\]"

Aha! So I should simply change my search from the above listed current form to the below? Brilliant!
search(:node, "chef_environment:#{node['chef_environment']} AND run_list:role\[xyz\]")

It definitely sounds like you and Ian have both solved one part each of the problems I was experiencing - that I was looking at the dynamic value when I wanted the permanent one (independent of last run status), and that the reason the dynamic one was letting me down so often was due to a bug in the shipped value for maxFieldLength in solr.

Thanks very much indeed, I'm pretty confident that the combination of Ian's suggested fix, and this config change above will solve the issues I was seeing!

Cheers

Dan



Archive powered by MHonArc 2.6.16.

§