class Puppet::FileServing::Content

A class that handles retrieving file contents. It only reads the file when its content is specifically asked for.

Attributes

content[W]

Public Class Methods

from_binary(content) click to toggle source
   # File lib/puppet/file_serving/content.rb
18 def self.from_binary(content)
19   instance = new("/this/is/a/fake/path")
20   instance.content = content
21   instance
22 end
supported_formats() click to toggle source
   # File lib/puppet/file_serving/content.rb
14 def self.supported_formats
15   [:binary]
16 end

Public Instance Methods

collect(source_permissions = nil) click to toggle source

This is no longer used, but is still called by the file server implementations when interacting with their model abstraction.

   # File lib/puppet/file_serving/content.rb
26 def collect(source_permissions = nil)
27 end
content() click to toggle source

Read the content of our file in.

   # File lib/puppet/file_serving/content.rb
30 def content
31   unless @content
32     # This stat can raise an exception, too.
33     raise(ArgumentError, _("Cannot read the contents of links unless following links")) if stat.ftype == "symlink"
34 
35     @content = Puppet::FileSystem.binread(full_path)
36   end
37   @content
38 end
to_binary() click to toggle source
   # File lib/puppet/file_serving/content.rb
40 def to_binary
41   File.new(full_path, "rb")
42 end