[chef] Re: Re: ruby code in lwRp decalaration


Chronological Thread 
  • From: Daniel DeLeo < >
  • To:
  • Subject: [chef] Re: Re: ruby code in lwRp decalaration
  • Date: Fri, 31 May 2013 11:03:37 -0700


On Friday, May 31, 2013 at 10:16 AM, Andrew Gross wrote:

You will probably have to write up a HWRP to get the kind of lazy evaluation you want


On Fri, May 31, 2013 at 12:51 PM, Dorian Jaminais < " target="_blank"> > wrote:
Hi all,

In a LRWP resource definition (the file in ./resources), is it possible to do something like :
actions :install
default_action :install
attribute :name, :kind_of => String, :name_attribute => true
attribute :repository, :kind_of => String, :default => node[:name]['repository']
LWRPs are basically a wrapper around `class_eval`, so for most cases you can just add a little more traditional ruby method definition where you need it.

You only *have to* use HWRPs if you need full control of the Class name or its superclass.

-- 
Daniel DeLeo
 



Archive powered by MHonArc 2.6.16.

§