Sha256: c7055e0b73357ad1b4e6aa6f2d929df95a17acafa369327f4c5c572de5fbeedd

Contents?: true

Size: 1.12 KB

Versions: 20

Compression:

Stored size: 1.12 KB

Contents

# frozen_string_literal: true
require_relative '../../puppet/file_serving'
require_relative '../../puppet/file_serving/fileset'

# Define some common methods for FileServing termini.

module Puppet::FileServing::TerminusHelper
  # Create model instance for a file in a file server.
  def path2instance(request, path, options = {})
    result = model.new(path, :relative_path => options[:relative_path])
    result.links = request.options[:links] if request.options[:links]

    result.checksum_type = request.options[:checksum_type] if request.options[:checksum_type]
    result.source_permissions = request.options[:source_permissions] if request.options[:source_permissions]

    result.collect

    result
  end

  # Create model instances for all files in a fileset.
  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
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
puppet-8.3.0 lib/puppet/file_serving/terminus_helper.rb
puppet-8.3.0-x86-mingw32 lib/puppet/file_serving/terminus_helper.rb
puppet-8.3.0-x64-mingw32 lib/puppet/file_serving/terminus_helper.rb
puppet-8.3.0-universal-darwin lib/puppet/file_serving/terminus_helper.rb
puppet-8.3.1 lib/puppet/file_serving/terminus_helper.rb
puppet-8.3.1-x86-mingw32 lib/puppet/file_serving/terminus_helper.rb
puppet-8.3.1-x64-mingw32 lib/puppet/file_serving/terminus_helper.rb
puppet-8.3.1-universal-darwin lib/puppet/file_serving/terminus_helper.rb
puppet-8.2.0 lib/puppet/file_serving/terminus_helper.rb
puppet-8.2.0-x86-mingw32 lib/puppet/file_serving/terminus_helper.rb
puppet-8.2.0-x64-mingw32 lib/puppet/file_serving/terminus_helper.rb
puppet-8.2.0-universal-darwin lib/puppet/file_serving/terminus_helper.rb
puppet-8.1.0 lib/puppet/file_serving/terminus_helper.rb
puppet-8.1.0-x86-mingw32 lib/puppet/file_serving/terminus_helper.rb
puppet-8.1.0-x64-mingw32 lib/puppet/file_serving/terminus_helper.rb
puppet-8.1.0-universal-darwin lib/puppet/file_serving/terminus_helper.rb
puppet-8.0.1 lib/puppet/file_serving/terminus_helper.rb
puppet-8.0.1-x86-mingw32 lib/puppet/file_serving/terminus_helper.rb
puppet-8.0.1-x64-mingw32 lib/puppet/file_serving/terminus_helper.rb
puppet-8.0.1-universal-darwin lib/puppet/file_serving/terminus_helper.rb