Sha256: 6de5ad9665c02a24ea5a07d89e8155d6a8e386525f896c54c45fa715d3308263

Contents?: true

Size: 826 Bytes

Versions: 2

Compression:

Stored size: 826 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].to_sym
      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

2 entries across 2 versions & 1 rubygems

Version Path
puppet-3.0.0.rc5 lib/puppet/file_serving/terminus_selector.rb
puppet-3.0.0.rc4 lib/puppet/file_serving/terminus_selector.rb