[chef] Re: Re: Re: Re: LWRP, append text to file only if it doesnt comtain it


Chronological Thread 
  • From: Ranjib Dey < >
  • To: " " < >
  • Subject: [chef] Re: Re: Re: Re: LWRP, append text to file only if it doesnt comtain it
  • Date: Tue, 10 Mar 2015 11:19:10 -0700

and you can combine these as well. an lwrp is a subclass of LWRPBase , with instance eval. Chef does the evaluation magic. if you inherit straight from LWRPBase, you can use the standard `attribute` etc method. :-)


On Tue, Mar 10, 2015 at 10:56 AM, AJ Christensen < " target="_blank"> > wrote:
This is the new "Heavy Weight Resource Provider" post-LWRP paradigm.
It's more or less like a rubygem in cookbook form and is not subject
to some of the complexities of developing reusable resources with the
LWRP system.

In addition, LWRP and HWRP can be combined during implementation:
Subclassing of other providers and advanced Ruby OO capabilities are
afforded in the HWRP variants. I like to make light weight resources
(because the DSL is friendly) and then extended/heavy-weight reusable
provider implementations.

cheers,

--aj

On Wed, Mar 11, 2015 at 6:45 AM, Medya < "> > wrote:
> that is beautiful ! btw I am looking at the source code, why somera has put
> all the code in the library folder ? shouldn't it have resource and provider
> folder? is it old way of doing it?
>
> On Tue, Mar 10, 2015 at 12:26 PM, AJ Christensen
> < > wrote:
>>
>> Use someara's line cookbook: https://supermarket.chef.io/cookbooks/line
>>
>> append_if_no_line "make sure a line is in dangerfile" do
>>   path "/tmp/dangerfile"
>>   line "HI THERE I AM STRING"
>> end
>>
>> Consider searching the supermarket for cookbooks before sending a
>> message to every Chef community mailing list user like this. Thanks in
>> advance.
>>
>> cheers,
>>
>> --aj
>>
>> On Wed, Mar 11, 2015 at 6:18 AM, Medya < "> > wrote:
>> > is there any LWRP way to do append a text to a file if it does NOT
>> > contain
>> > it ?
>> >
>> > for exmaple
>> >
>> > add PEERDNS=no to this file
>> > /etc/sysconfig/network-scripts/ifcfg-eth0
>> >
>> > only if it is not there
>
>




Archive powered by MHonArc 2.6.16.

§