Method: Puppet::FileServing::Mount::Plugins#search

Defined in:
lib/puppet/file_serving/mount/plugins.rb

#search(relative_path, request) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/puppet/file_serving/mount/plugins.rb', line 17

def search(relative_path, request)
  # We currently only support one kind of search on plugins - return
  # them all.
  paths = request.environment.modules.find_all { |mod| mod.plugins? }.collect { |mod| mod.plugin_directory }
  if paths.empty?
    # If the modulepath is valid then we still need to return a valid root
    # directory for the search, but make sure nothing inside it is
    # returned.
    request.options[:recurse] = false
    request.environment.modulepath.empty? ? [Puppet[:codedir]] : request.environment.modulepath
  else
    paths
  end
end