Bilal Naeem
Bilal Naeem

Reputation: 1

Error while using custom LWRP in Chef

I am using a custom LWRP in a recipe in Chef. I have performed the following steps to do that:

  1. Create a resources folder with a resource.rb file which contains the necessary attributes and actions.
  2. Create a providers folder with a provider.rb file which contains the definition for each actions mentioned
  3. Updated my recipe to use the LWRP.

I have an action :normalize_customer_domain which is defined as follows

action :normalize_customer_domain do
    converge_by('Normalizing Customer Domain') do
        dns = AzureDns::DNS.new(@new_resource.prg, @new_resource.azure_rest_token, @new_resource.dns_attributes)
        node.set["normalize_customer_domain"] = dns.normalize_customer_domain(@new_resource.customer_domain)
    end

    @new_resource.updated_by_last_action(true)
end

I am using this LWRP in the recipe as such

azuredns_dns 'DNS' do
  prg node['platform-resource-group']
  azure_rest_token node['azure_rest_token']
  dns_attributes service_attrs
  customer_domain node['customer_domain']
  action :normalize_customer_domain
end

Where azuredns is the cookbook name and dns is the name of the custom LWRP. All the attributes are defined in the resource file as such

actions :normalize_customer_domain
attribute :prg, :required => true
attribute :azure_rest_token, :required => true
attribute :dns_attributes, :required => true
attribute :customer_domain, :required => false

The issue that I am having is that when my recipe executes, it does not perform the action specified in the LWRP. The action specified in the provider.rb performs a simple puts operation. No output is displayed which shows that the action is not being performed/executed.

What could be the cause of this issue? Please suggest the necessary steps I could take to resolve this issue.

Upvotes: 0

Views: 74

Answers (0)

Related Questions