Module: Puppet::FileServing::TerminusHelper

Included in:
Indirector::DirectFileServer, Indirector::FileServer
Defined in:
lib/vendor/puppet/file_serving/terminus_helper.rb

Overview

Define some common methods for FileServing termini.

Instance Method Summary collapse

Instance Method Details

#path2instances(request, *paths) ⇒ Object

Create model instances for all files in a fileset.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/vendor/puppet/file_serving/terminus_helper.rb', line 7

def path2instances(request, *paths)
  filesets = paths.collect do |path|
    # Filesets support indirector requests as an options collection
    Puppet::FileServing::Fileset.new(path, request)
  end

  Puppet::FileServing::Fileset.merge(*filesets).collect do |file, base_path|
    inst = model.new(base_path, :relative_path => file)
    inst.checksum_type = request.options[:checksum_type] if request.options[:checksum_type]
    inst.links = request.options[:links] if request.options[:links]
    inst.collect
    inst
  end
end