module Puppet::FileServing::TerminusSelector

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.

Public Instance Methods

select(request) click to toggle source
   # File lib/puppet/file_serving/terminus_selector.rb
 8 def select(request)
 9   # We rely on the request's parsing of the URI.
10 
11   case request.protocol
12   when "file"
13     :file
14   when "puppet"
15     if request.server
16       :rest
17     else
18       Puppet[:default_file_terminus]
19     end
20   when "http","https"
21     :http
22   when nil
23     if Puppet::Util.absolute_path?(request.key)
24       :file
25     else
26       :file_server
27     end
28   else
29     raise ArgumentError, _("URI protocol '%{protocol}' is not currently supported for file serving") % { protocol: request.protocol }
30   end
31 end