Sha256: a97dd7801b5d88e0780aa495b23c356400f40015db5947a8e44894c9e70bb4a6

Contents?: true

Size: 881 Bytes

Versions: 303

Compression:

Stored size: 881 Bytes

Contents

require 'puppet/file_serving'

# This module is used to pick the appropriate terminus
# in file-serving indirections.  This is necessary because
# the terminus varies based on the URI asked for.
module Puppet::FileServing::TerminusSelector
  def select(request)
    # We rely on the request's parsing of the URI.

    # Short-circuit to :file if it's a fully-qualified path or specifies a 'file' protocol.
    if Puppet::Util.absolute_path?(request.key)
      return :file
    end

    case request.protocol
    when "file"
      :file
    when "puppet"
      if request.server
        :rest
      else
        Puppet[:default_file_terminus]
      end
   when "http","https"
     :http
    when nil
      :file_server
    else
      raise ArgumentError, _("URI protocol '%{protocol}' is not currently supported for file serving") % { protocol: request.protocol }
    end
  end
end

Version data entries

303 entries across 303 versions & 2 rubygems

Version Path
puppet-5.5.22 lib/puppet/file_serving/terminus_selector.rb
puppet-5.5.22-x86-mingw32 lib/puppet/file_serving/terminus_selector.rb
puppet-5.5.22-x64-mingw32 lib/puppet/file_serving/terminus_selector.rb
puppet-5.5.22-universal-darwin lib/puppet/file_serving/terminus_selector.rb
puppet-5.5.21 lib/puppet/file_serving/terminus_selector.rb
puppet-5.5.21-x86-mingw32 lib/puppet/file_serving/terminus_selector.rb
puppet-5.5.21-x64-mingw32 lib/puppet/file_serving/terminus_selector.rb
puppet-5.5.21-universal-darwin lib/puppet/file_serving/terminus_selector.rb
puppet-6.16.0 lib/puppet/file_serving/terminus_selector.rb
puppet-6.16.0-x86-mingw32 lib/puppet/file_serving/terminus_selector.rb
puppet-6.16.0-x64-mingw32 lib/puppet/file_serving/terminus_selector.rb
puppet-6.16.0-universal-darwin lib/puppet/file_serving/terminus_selector.rb
puppet-6.15.0 lib/puppet/file_serving/terminus_selector.rb
puppet-6.15.0-x86-mingw32 lib/puppet/file_serving/terminus_selector.rb
puppet-6.15.0-x64-mingw32 lib/puppet/file_serving/terminus_selector.rb
puppet-6.15.0-universal-darwin lib/puppet/file_serving/terminus_selector.rb
puppet-5.5.20 lib/puppet/file_serving/terminus_selector.rb
puppet-5.5.20-x86-mingw32 lib/puppet/file_serving/terminus_selector.rb
puppet-5.5.20-x64-mingw32 lib/puppet/file_serving/terminus_selector.rb
puppet-5.5.20-universal-darwin lib/puppet/file_serving/terminus_selector.rb