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
19 def self.from_binary(content)
20   instance = new("/this/is/a/fake/path")
21   instance.content = content
22   instance
23 end
supported_formats() click to toggle source
   # File lib/puppet/file_serving/content.rb
15 def self.supported_formats
16   [:binary]
17 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
27 def collect(source_permissions = nil)
28 end
content() click to toggle source

Read the content of our file in.

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