[chef] Re: Re: Re: LWRP being defined inside libraries directory?


Chronological Thread 
  • From: James Scott < >
  • To: " " < >
  • Subject: [chef] Re: Re: Re: LWRP being defined inside libraries directory?
  • Date: Tue, 4 Nov 2014 09:18:34 -0800

We have a page about these on chef-docs as well:


Here's the overview page for building custom resources: http://docs.getchef.com/lwrp_custom.html

As Peter already mentioned, Jon Cowie's book has a terrific chapter on the HWRP approach.


On Tue, Nov 4, 2014 at 8:15 AM, Peter Burkholder < " target="_blank"> > wrote:
Jon Cowie's book http://shop.oreilly.com/product/0636920032984.do has a good chapter on HWRPs. 

On Tue, Nov 4, 2014 at 10:48 AM, Daniel DeLeo < " target="_blank"> > wrote:
On Tuesday, November 4, 2014 at 6:38 AM, aL. wrote:
>
> https://github.com/opscode-cookbooks/database/tree/master/libraries
>
> Is there a new pattern i'm missing?

These are what people are calling “heavy weight resources and providers” or HWRP. The downside of doing this is that you need to write your code in a more pure ruby way, with less help from the DSL. The benefit is that you fully control the class names (and therefore the names of resources, too). It also means you don’t need as much magic to be able to test your code. If you want to test a LWRP in isolation, you have to know to use this method: https://github.com/opscode/chef/blob/ff9147776117f6a5592449384ab6f6ff6605e9be/lib/chef/provider/lwrp_base.rb#L83 in order to make Chef create the LWRP classes, which is not something most people know to do.

Noah has been working on a sort of middle ground, with his poise stuff, see here: https://github.com/poise/poise

>
>
> --
> Si necesitas una máquina para hacer algo y no la compras al final te darás cuenta de que has pagado lo mismo y no tienes la máquina.--Henry Ford
>
> Alberto


--
Daniel DeLeo








Archive powered by MHonArc 2.6.16.

§