Created
March 8, 2012 14:05
-
-
Save earzur/2001122 to your computer and use it in GitHub Desktop.
Some problem with chef search
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| run_date = Time.now | |
| ruby_block "add current date" do | |
| block do | |
| node[:test_last_chef_run] = run_date.to_i | |
| node.save | |
| end | |
| action :create | |
| end | |
| ruby_block "search for matching nodes ..." do | |
| block do | |
| nodes = search(:node,"test_last_chef_run:#{run_date.to_i}") | |
| Chef::Log.info "Found #{nodes.size} nodes : #{nodes.to_s} " | |
| end | |
| action :create | |
| end |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
the nodes array in the second block always comes empty - this problem prevents the mongodb cookbook to find a member of a replicaset it has just configured (at bootstrap time - when the node isn't registered yet).
Is there a way to make sure the node is in the index before calling :search ?
should i force the current node in the search results instead ?