The creation of a custom LWRP are reporting that the resource is nil into the Chef's resource context . This was my first step?
action :install do
converge_by "Installing postgresql-#{@new_resource.version}" do
execute "sudo apt-get install postgresql-#{@new_resource.version} #{@new_resource.options}" do
not_if { "dpkg --get-selections | grep postgresql-#{VERSION}" }
end
@new_resource.updated_by_last_action(true)
end
end
But, I save the global variable value in other local variable. Like this:
action :install do
converge_by "Installing postgresql-#{@new_resource.version}" do
VERSION = @new_resource.version
OPTIONS = @new_resource.options
execute "sudo apt-get install postgresql-#{VERSION} #{OPTIONS}" do
not_if { "dpkg --get-selections | grep postgresql-#{VERSION}" }
end
@new_resource.updated_by_last_action(true)
end
end
And then, the problem was resolved.
Is there a problem in the Chef resources context with the global variables?