Sha256: 9b50db3881438b785dde4100ac93262575d1e69bd795ec973e65b53774d54ba9

Contents?: true

Size: 819 Bytes

Versions: 135

Compression:

Stored size: 819 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 nil
      :file_server
    else
      raise ArgumentError, "URI protocol '#{request.protocol}' is not currently supported for file serving"
    end
  end
end

Version data entries

135 entries across 135 versions & 3 rubygems

Version Path
puppet-3.8.2-x86-mingw32 lib/puppet/file_serving/terminus_selector.rb
puppet-3.8.2-x64-mingw32 lib/puppet/file_serving/terminus_selector.rb
puppet-retrospec-0.7.3 vendor/gems/puppet-3.7.3/lib/puppet/file_serving/terminus_selector.rb
puppet-4.2.1 lib/puppet/file_serving/terminus_selector.rb
puppet-4.2.1-x86-mingw32 lib/puppet/file_serving/terminus_selector.rb
puppet-4.2.1-x64-mingw32 lib/puppet/file_serving/terminus_selector.rb
puppet-4.2.0 lib/puppet/file_serving/terminus_selector.rb
puppet-4.2.0-x86-mingw32 lib/puppet/file_serving/terminus_selector.rb
puppet-4.2.0-x64-mingw32 lib/puppet/file_serving/terminus_selector.rb
puppet-retrospec-0.7.2 vendor/gems/puppet-3.7.3/lib/puppet/file_serving/terminus_selector.rb
puppet-3.8.1 lib/puppet/file_serving/terminus_selector.rb
puppet-3.8.1-x86-mingw32 lib/puppet/file_serving/terminus_selector.rb
puppet-3.8.1-x64-mingw32 lib/puppet/file_serving/terminus_selector.rb
puppet-4.1.0 lib/puppet/file_serving/terminus_selector.rb
puppet-4.1.0-x86-mingw32 lib/puppet/file_serving/terminus_selector.rb
puppet-4.1.0-x64-mingw32 lib/puppet/file_serving/terminus_selector.rb
puppet-4.0.0 lib/puppet/file_serving/terminus_selector.rb
puppet-4.0.0-x86-mingw32 lib/puppet/file_serving/terminus_selector.rb
puppet-4.0.0-x64-mingw32 lib/puppet/file_serving/terminus_selector.rb
puppet-3.7.5 lib/puppet/file_serving/terminus_selector.rb