From 897ca7a86b9595761e1492a4ffa36bbdb751a15a Mon Sep 17 00:00:00 2001 From: Luchian Nemes Date: Thu, 3 Sep 2020 09:37:21 +0300 Subject: (MODULES-7397) Load Augeas lenses from modules When creating the load path for Augeas, the module directories are now also searched for lenses and their folder path is added accordingly. This happens in every context except `agent` application. Through plugin syncing (and later cached lenses) it does not need these extra paths. --- lib/puppet/provider/augeas/augeas.rb | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'lib/puppet') diff --git a/lib/puppet/provider/augeas/augeas.rb b/lib/puppet/provider/augeas/augeas.rb index bfa3852..c8f9643 100644 --- a/lib/puppet/provider/augeas/augeas.rb +++ b/lib/puppet/provider/augeas/augeas.rb @@ -367,8 +367,18 @@ Puppet::Type.type(:augeas).provide(:augeas) do load_path.flatten! end - if Puppet::FileSystem.exist?("#{Puppet[:libdir]}/augeas/lenses") - load_path << "#{Puppet[:libdir]}/augeas/lenses" + if Puppet::Application.name == :agent + if Puppet::FileSystem.exist?("#{Puppet[:libdir]}/augeas/lenses") + load_path << "#{Puppet[:libdir]}/augeas/lenses" + end + else + env = Puppet.lookup(:current_environment) + env.each_plugin_directory do |dir| + lenses = File.join(dir, 'augeas', 'lenses') + if File.exist?(lenses) + load_path << lenses + end + end end load_path.join(':') -- cgit v1.2.3