summaryrefslogtreecommitdiffstats
path: root/lib/puppet/indirector/file_server.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/indirector/file_server.rb')
-rw-r--r--lib/puppet/indirector/file_server.rb88
1 files changed, 44 insertions, 44 deletions
diff --git a/lib/puppet/indirector/file_server.rb b/lib/puppet/indirector/file_server.rb
index 833fc6f82..46a08c97d 100644
--- a/lib/puppet/indirector/file_server.rb
+++ b/lib/puppet/indirector/file_server.rb
@@ -9,61 +9,61 @@ require 'puppet/indirector/terminus'
# Look files up using the file server.
class Puppet::Indirector::FileServer < Puppet::Indirector::Terminus
- include Puppet::FileServing::TerminusHelper
+ include Puppet::FileServing::TerminusHelper
- # Is the client authorized to perform this action?
- def authorized?(request)
- return false unless [:find, :search].include?(request.method)
+ # Is the client authorized to perform this action?
+ def authorized?(request)
+ return false unless [:find, :search].include?(request.method)
- mount, file_path = configuration.split_path(request)
+ 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
+ # If we're not serving this mount, then access is denied.
+ return false unless mount
+ mount.allowed?(request.node, request.ip)
+ end
- # Find our key using the fileserver.
- def find(request)
- mount, relative_path = configuration.split_path(request)
+ # Find our key using the fileserver.
+ def find(request)
+ mount, relative_path = configuration.split_path(request)
- return nil unless mount
+ 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
+ # 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
- # Search for files. This returns an array rather than a single
- # file.
- def search(request)
- mount, relative_path = configuration.split_path(request)
+ # Search for files. This returns an array rather than a single
+ # file.
+ def search(request)
+ mount, relative_path = configuration.split_path(request)
- unless mount and paths = mount.search(relative_path, request)
- Puppet.info "Could not find filesystem info for file '#{request.key}' in environment #{request.environment}"
- return nil
- end
+ unless mount and paths = mount.search(relative_path, request)
+ Puppet.info "Could not find filesystem info for file '#{request.key}' in environment #{request.environment}"
+ return nil
+ end
- filesets = paths.collect do |path|
- # Filesets support indirector requests as an options collection
- Puppet::FileServing::Fileset.new(path, request)
- end
+ filesets = paths.collect do |path|
+ # Filesets support indirector requests as an options collection
+ Puppet::FileServing::Fileset.new(path, request)
+ end
- Puppet::FileServing::Fileset.merge(*filesets).collect do |file, base_path|
- inst = model.new(base_path, :relative_path => file)
- inst.links = request.options[:links] if request.options[:links]
- inst.collect
- inst
- end
+ Puppet::FileServing::Fileset.merge(*filesets).collect do |file, base_path|
+ inst = model.new(base_path, :relative_path => file)
+ inst.links = request.options[:links] if request.options[:links]
+ inst.collect
+ inst
end
+ end
- private
+ private
- # Our fileserver configuration, if needed.
- def configuration
- Puppet::FileServing::Configuration.create
- end
+ # Our fileserver configuration, if needed.
+ def configuration
+ Puppet::FileServing::Configuration.create
+ end
end