Class: Puppet::FileServing::Mount::PluginFacts

Inherits:
Puppet::FileServing::Mount show all
Defined in:
lib/puppet/file_serving/mount/pluginfacts.rb

Overview

Find files in the modules’ pluginfacts directories. This is a very strange mount because it merges many directories into one.

Constant Summary

Constants included from Util::Logging

Util::Logging::FILE_AND_LINE, Util::Logging::FILE_NO_LINE, Util::Logging::MM, Util::Logging::NO_FILE_LINE, Util::Logging::SUPPRESS_FILE_LINE

Instance Attribute Summary

Attributes inherited from Puppet::FileServing::Mount

#name

Instance Method Summary collapse

Methods inherited from Puppet::FileServing::Mount

#initialize, #to_s, #validate

Methods included from Util::Logging

#clear_deprecation_warnings, #debug, #deprecation_warning, #format_exception, #get_deprecation_offender, #log_and_raise, #log_deprecations_to_file, #log_exception, #puppet_deprecation_warning, #send_log, setup_facter_logging!, #warn_once

Methods inherited from Network::AuthStore

#allow, #allow_ip, #allowed?, #deny, #deny_ip, #empty?, #globalallow?, #initialize, #interpolate, #reset_interpolation, #to_s

Constructor Details

This class inherits a constructor from Puppet::FileServing::Mount

Instance Method Details

#find(relative_path, request) ⇒ Object

Return an instance of the appropriate class.



8
9
10
11
12
13
14
# File 'lib/puppet/file_serving/mount/pluginfacts.rb', line 8

def find(relative_path, request)
  return nil unless mod = request.environment.modules.find { |m|  m.pluginfact(relative_path) }

  path = mod.pluginfact(relative_path)

  path
end

#search(relative_path, request) ⇒ Object



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

def search(relative_path, request)
  # We currently only support one kind of search on plugins - return
  # them all.
  Puppet.debug("Warning: calling Plugins.search with empty module path.") if request.environment.modules.empty?
  paths = request.environment.modules.find_all { |mod| mod.pluginfacts? }.collect { |mod| mod.plugin_fact_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? ? nil : request.environment.modulepath
  else
    paths
  end
end

#valid?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/puppet/file_serving/mount/pluginfacts.rb', line 32

def valid?
  true
end