[chef] custom lwrp


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

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.

§