[chef] Re: Re: custom lwrp


Chronological Thread 
  • From: Ameya Savale < >
  • To:
  • Subject: [chef] Re: Re: custom lwrp
  • Date: Tue, 23 Dec 2014 12:32:45 -0800

oh I see thanks for you help

- Ameya

On Tue, Dec 23, 2014 at 12:18 PM, AJ Christensen < " target="_blank"> > wrote:
It should be (@new_resource.tags)`

hth,

--aj

On Wed, Dec 24, 2014 at 9:14 AM, Ameya Savale < "> > wrote:
> Hi I've been having a bit of trouble creating my custom lwrp
>
> I have declared a custom resource, but the issue I'm having is setting
> values for attributes that I declare for the resource.  Here is my resource:
>
> actions :add
> default_action :add
>
> attribute :username, :name_attribute => true, :kind_of => String, :required
> => true
> attribute :password, :kind_of => String
> attribute :tags, :kind_of => String
>
> state_attrs :username,
>                         :tags
>
> attr_accessor :exists
>
> so when i try to access the tags attribute of the resource in my provider I
> get the following error:
>
> NoMethodError: undefined method `tags=' for Chef::Resource::RabbitmqUsers
>
> @current_resource =
> Chef::Resource::RabbitmqUsers.new(@new_resource.username)
> @current_resource.tags = @new_resource.tags
>
> Its on the second line that i hit the error, specifically on
> @current_resource.tags, @new_resource.tags has the correct value when I
> print it out. Not sure what I'm missing here.
>
> - Thanks
> Ameya
>




Archive powered by MHonArc 2.6.16.

§