Method: Puppet::Property::Ensure#retrieve

Defined in:
lib/vendor/puppet/property/ensure.rb

#retrieveObject



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/vendor/puppet/property/ensure.rb', line 61

def retrieve
  # XXX This is a problem -- whether the object exists or not often
  # depends on the results of other properties, yet we're the first property
  # to get checked, which means that those other properties do not have
  # @is values set.  This seems to be the source of quite a few bugs,
  # although they're mostly logging bugs, not functional ones.
  if prov = @resource.provider and prov.respond_to?(:exists?)
    result = prov.exists?
  elsif @resource.respond_to?(:exists?)
    result = @resource.exists?
  else
    raise Puppet::DevError, "No ability to determine if #{@resource.class.name} exists"
  end
  if result
    return :present
  else
    return :absent
  end
end