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


Chronological Thread 
  • From: Peter Burkholder < >
  • To:
  • Subject: [chef] Re: Re: LWRP being defined inside libraries directory?
  • Date: Tue, 4 Nov 2014 11:15:12 -0500

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.

§