Module: Puppet::FileServing::TerminusHelper Private
- Defined in:
- lib/puppet/file_serving/terminus_helper.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Define some common methods for FileServing termini.
Instance Method Summary collapse
-
#path2instance(request, path, options = {}) ⇒ Object
private
Create model instance for a file in a file server.
-
#path2instances(request, *paths) ⇒ Object
private
Create model instances for all files in a fileset.
Instance Method Details
#path2instance(request, path, options = {}) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Create model instance for a file in a file server.
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/puppet/file_serving/terminus_helper.rb', line 8 def path2instance(request, path, = {}) result = model.new(path, :relative_path => [:relative_path]) result.links = request.[:links] if request.[:links] result.checksum_type = request.[:checksum_type] if request.[:checksum_type] result. = request.[:source_permissions] if request.[:source_permissions] result.collect result end |
#path2instances(request, *paths) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Create model instances for all files in a fileset.
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/puppet/file_serving/terminus_helper.rb', line 21 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| path2instance(request, base_path, :relative_path => file) end end |