The provided code is using @property_hash and @resource both with brackets to reference a hashed property. Either one could be the reported symptom of derefrencing  on nil.
@resource should exist once the type is instantiated. You can see this by comparing with rspec nil with the return of instances or Type(:yourtype).new($somedata) and seeing the failure results. The diff should contain a tree of available data and symbols including the always present @resource and any getter or setter methods.
Since you have self.instances I would check that it did not return nothing as well. Checking your code I see that it does not call new in self.instances on the data it collects. I would not expect that to work. (Also since you have self.instances you might be able to leverage mkresourcemethods instead of the wall of getter/setter used here. See Building a Provider that uses Self.instances.)
@property_hash is only populated when self.instances exists in a provider. It is created on the return value of that function which should have passed through the call to new to instantiate a new instance of the type. See the Puppet provider.rb for the documentation (350-379 in https://github.com/puppetlabs/puppet/blob/master/lib/puppet/provider.rb).
Asked: 2015-09-17 10:46:47 -0500
Seen: 531 times
Last updated: Sep 21 '15