Sha256: 03aa5f6b6b440d45a34dfb3fc067b215d22496b8dee40ee0b1ce71f7c82b5f2f

Contents?: true

Size: 847 Bytes

Versions: 20

Compression:

Stored size: 847 Bytes

Contents

# frozen_string_literal: true
require_relative '../../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.

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

Version data entries

20 entries across 20 versions & 1 rubygems

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