The query method is called by the Puppet::Provider::Package
base type. The properties
method populates the property_hash
using the query
method:
# Look up the current status.
def properties
if @property_hash.empty?
@property_hash = query || {:ensure => :absent}
@property_hash[:ensure] = :absent if @property_hash.empty?
end
@property_hash.dup
end
In the rubydoc of Puppet::Provider
it says the following about the property_hash
:
Property hash - the important instance variable @property_hash
contains all current state values for properties (it is lazily built).
It is important that these values are managed appropriately in the
methods {instances}, {prefetch}, and in methods that alters the
current state (those that change the lifecycle (creates, destroys), or
alters some value reflected backed by a property).
Thus, query should return a hash that reflects the current state of the package expressed in Puppet's package properties.
This is not documented AFAIK. I figured it out by reverse engineering.
Hope this helps. Good luck!