[chef] Re: Re: Re: search and order of results


Chronological Thread 
  • From: John Alberts < >
  • To:
  • Subject: [chef] Re: Re: Re: search and order of results
  • Date: Thu, 27 May 2010 09:11:13 -0500
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=iG6RClu7DG449lXqUhiZalIkHxkWMdCqZjeOiiQd60f425f92HTWiTRt4zYX64lmiT IX0AA55cAchTSxDsWrGKSArbFyJxF1jAQawabvcjSJ96ByStJyYEcvLX1wAOexLGQ95b NA6R1C3nllqTgWYITBqo4IHLAMyiWXKIHxgOM=

Don't feel bad.  I just asked the same question on #chef yesterday.  :)


On Wed, May 26, 2010 at 10:34 PM, Joshua Miller < "> > wrote:
I love ridding public transportation as is give me a mental break and go duh ... .sort


  template "/etc/perlbal/perlbal.conf" do
    source "perlbal.conf.erb"
    mode 0440
    owner "root"
    group "root"
    variables(
      :WEBSERVER_ROLE_host => WEBSERVER_ROLE_host.sort,
      :APACHE_ROLE_host => APACHE_ROLE_host.sort

    )
    backup 1
    notifies :restart, resources(:service => "perlbal")
  end


On May 26, 2010, at 8:14 PM, Mark Imbriaco wrote:



On May 26, 2010, at 10:08 PM, Joshua Miller < " target="_blank"> > wrote:

Search order is inconsistent, is there a way to deal with it?  I really would not care except every time chef runs it restarts perbal which is a issue.

[snip]

search(:node, "role:WEBSERVER_ROLE") do |n|
   WEBSERVER_ROLE_host << n['ipaddress']
 end

[snip]

My Template:

CREATE POOL app_pool
<% @WEBSERVER_ROLE_host.each do |n| -%>
 POOL app_pool ADD <%= n %>:80
<% end -%>

You could do something like WEBSERVER_ROLE_host.sort.each in the template to ensure that the array is sorted before you iterate over it.

-Mark




--
John Alberts




Archive powered by MHonArc 2.6.16.

§