[chef] Re: Re: Re: Re: Re: Re: Force recipe to run at the end


Chronological Thread 
  • From: Julien Vehent < >
  • To: < >
  • Subject: [chef] Re: Re: Re: Re: Re: Re: Force recipe to run at the end
  • Date: Mon, 01 Oct 2012 21:35:26 -0400

On 2012-09-26 03:15, Phil Dibowitz wrote:
On 09/25/2012 07:02 PM, Julien Vehent wrote:
Thanks. I updated the cookbook: http://community.opscode.com/cookbooks/afw
One thing that I'm not 100% comfortable with (despite the great help on #chef)
is how to export a single function from a given module to other cookbooks. In
this case, I have AFW.create_rule() that simply calls the internal function
AFWCore.process_rule(). I'm guessing this could be done better, but being
primarily a sysadmin/security and not really a rubyist, I'm not sure how.

That's totally fine. I only did a quick scan of the code, but if I read it
correctly, create_rule() is just a wrapper for some sanity checking and then
adding the rule to the node object, right?

That's completely reasonable. That all then gets added a compile time, and at
runtime when your template is processed all the data is there.

Again, I only did a very quick glance at the code, but it seems good in
general.

I have a problem with the "extend" function. This code:

module AFW
  extend AFWCore
  <....>
end

(see https://github.com/jvehent/AFW/blob/master/libraries/create_rule.rb ;)

works perfectly fine in chef 10.12, but not in chef <= 10.10.

Quoting yfeldblum from #chef: "the problem is that there's no total order imposed as part of the API or part of the contract, and there's no supported API way for cookbooks and libraries themselves to request a partial order"

What would be the right way to do this, while making certain that it won't break earlier/future versions of chef ?

Thanks,
Julien



Archive powered by MHonArc 2.6.16.

§