Method: Puppet::Provider::ParsedFile.retrieve

Defined in:
lib/vendor/puppet/provider/parsedfile.rb

.retrieve(path) ⇒ Object

Retrieve the text for the file. Returns nil in the unlikely event that it doesn’t exist.



240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
# File 'lib/vendor/puppet/provider/parsedfile.rb', line 240

def self.retrieve(path)
  # XXX We need to be doing something special here in case of failure.
  text = target_object(path).read
  if text.nil? or text == ""
    # there is no file
    return []
  else
    # Set the target, for logging.
    old = @target
    begin
      @target = path
      return self.parse(text)
    rescue Puppet::Error => detail
      detail.file = @target
      raise detail
    ensure
      @target = old
    end
  end
end