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