lib/puppet/file_serving/metadata.rb
# Retrieve the attributes for this file, relative to a base directory.
# Note that File.stat raises Errno::ENOENT if the file is absent and this
# method does not catch that exception.
Retrieve the attributes for this file, relative to a base directory.
Note that File.stat raises Errno::ENOENT if the file is absent and this
method does not catch that exception.
Retrieve the attributes for this file relative to a base directory . Note that File . stat raises Errno :: ENOENT if the file is absent and this method does not catch that exception .
def collect
    real_path = full_path
    stat = collect_stat(real_path)
    @owner = stat.owner
    @group = stat.group
    @ftype = stat.ftype
    @mode = stat.mode & 007777
    case stat.ftype
    when "file"
      @checksum = ("{#{@checksum_type}}") + send("#{@checksum_type}_file", real_path).to_s
    when "directory" 
      @checksum_type = "ctime"
      @checksum = ("{#{@checksum_type}}") + send("#{@checksum_type}_file", path).to_s
    when "link"
      @destination = File.readlink(real_path)
      @checksum = ("{#{@checksum_type}}") + send("#{@checksum_type}_file", real_path).to_s rescue nil
    else
      raise ArgumentError, "Cannot manage files of type #{stat.ftype}"
    end
  end
def collect real_path = full_path stat = collect_stat ( real_path ) @owner = stat . owner @group = stat . group @ftype = stat . ftype @mode = stat . mode & 007777 case stat . ftype when "file" @checksum = ( "{#{@checksum_type}}" ) + send ( "#{@checksum_type}_file" , real_path ) . to_s when "directory" @checksum_type = "ctime" @checksum = ( "{#{@checksum_type}}" ) + send ( "#{@checksum_type}_file" , path ) . to_s when "link" @destination = File . readlink ( real_path ) @checksum = ( "{#{@checksum_type}}" ) + send ( "#{@checksum_type}_file" , real_path ) . to_s rescue nil else raise ArgumentError , "Cannot manage files of type #{stat.ftype}" end end
Retrieve the attributes for this file, relative to a base directory.
Retrieve the attributes for this file relative to a base directory .
# We have to mask the mode, yay. # Always just timestamp the directory.