Custom lwrp

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 :adddefault_action :addattribute :username, :name_attribute =>
true, :kind_of => String, :required => trueattribute :password, :kind_of =>
Stringattribute :tags, :kind_of => Stringstate_attrs :username,
:tagsattr_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

It should be @current_resource.tags(@new_resource.tags)

hth,

--aj

On Wed, Dec 24, 2014 at 9:14 AM, Ameya Savale ameya@simplyhired.com 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

oh I see thanks for you help

  • Ameya

On Tue, Dec 23, 2014 at 12:18 PM, AJ Christensen <
aj@junglistheavy.industries> wrote:

It should be @current_resource.tags(@new_resource.tags)

hth,

--aj

On Wed, Dec 24, 2014 at 9:14 AM, Ameya Savale ameya@simplyhired.com
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