class Puppet::Indirector::FileServer

Look files up using the file server.

Public Instance Methods

authorized?(request) click to toggle source

Is the client authorized to perform this action?

# File lib/puppet/indirector/file_server.rb, line 11
def authorized?(request)
  return false unless [:find, :search].include?(request.method)

  mount, file_path = configuration.split_path(request)

  # If we're not serving this mount, then access is denied.
  return false unless mount
  mount.allowed?(request.node, request.ip)
end
find(request) click to toggle source

Find our key using the fileserver.

# File lib/puppet/indirector/file_server.rb, line 22
def find(request)
  mount, relative_path = configuration.split_path(request)

  return nil unless mount

  # The mount checks to see if the file exists, and returns nil
  # if not.
  return nil unless path = mount.find(relative_path, request)
  result = model.new(path)
  result.links = request.options[:links] if request.options[:links]
  result.collect
  result
end