Class: Puppet::Node::Facts::Facter

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet-languageserver-sidecar/puppet_modulepath_monkey_patches.rb

Class Method Summary collapse

Class Method Details

.original_setup_search_pathsObject



133
# File 'lib/puppet-languageserver-sidecar/puppet_modulepath_monkey_patches.rb', line 133

alias original_setup_search_paths setup_search_paths

.setup_search_paths(request) ⇒ Object



134
135
136
137
138
139
140
141
142
143
144
# File 'lib/puppet-languageserver-sidecar/puppet_modulepath_monkey_patches.rb', line 134

def setup_search_paths(request)
  result = original_setup_search_paths(request)
  return result unless PuppetLanguageServerSidecar::Workspace.has_module_metadata?

  additional_dirs = %w[lib plugins].map { |path| File.join(PuppetLanguageServerSidecar::Workspace.root_path, path, 'facter') }
                                   .select { |path| FileTest.directory?(path) }

  return result if additional_dirs.empty?

  Facter.search(*additional_dirs)
end