Chef 12 duplicates nodes from a node search


#1

Has anyone noticed in Chef 12 the following scenario?

nodes = search(:node, "hostname:*)

returns duplicates of the last host added.

So any cookbook which then uses the nodes variable gets a duplicate.

That’s in a ruby recipe and likewise with the cli:

knife search “hostname:*” -c /etc/chef/client.rb

also showing a duplicate of the last returned node.

If you knife node delete and knife client delete the duplicate,
the next higher node is then listed as duplicated by the search() query.


#2

This required the following to fix:

chef-server-ctl reindex ORG
chef-client

My question is why would the index get out-of-order in the first place?

On Jun 9, 2015, at 3:58 PM, Stuart Cracraft smcracraft@me.com wrote:

Has anyone noticed in Chef 12 the following scenario?

nodes = search(:node, "hostname:*)

returns duplicates of the last host added.

So any cookbook which then uses the nodes variable gets a duplicate.

That’s in a ruby recipe and likewise with the cli:

knife search “hostname:*” -c /etc/chef/client.rb

also showing a duplicate of the last returned node.

If you knife node delete and knife client delete the duplicate,
the next higher node is then listed as duplicated by the search() query.


#3

I’ve fired the reindex and it looks like now the problem has been resolved. In my case the cause was the corruption of the postgresql due to a repeated and unexpected fault of the VMs.