I'm trying to write an LWRP for a Chef cookbook and I'm running into a strange issue where this property seems to be perfectly valid on one line, and the nil
the next.
From the provider code, error on the source
line:
def create_check
cookbook_file get_check_filename(@current_resource.checkname) do
source "checks/#{@current_resource.checkname}" # undefined method `checkname' for nil:NilClass
mode '0644'
action :create
end
end
and the load_current_resource
method just to show that it is initialized:
def load_current_resource
@current_resource = Chef::Resource::OmdCheck.new(@new_resource_name)
@current_resource.checkname(@new_resource.checkname) # right here!
@current_resource.sitename(@new_resource.sitename)
@current_resource.sitecfgroot(sprintf(CMK_CFGROOT_FRM, @new_resource.sitename))
@current_resource.perfometer(@new_resource.perfometer)
@current_resource.pnptemplate(@new_resource.pnptemplate)
@current_resource.exists = check_exists?(@current_resource.checkname)
end
Any help is much appreciated.