aboutsummaryrefslogtreecommitdiff
path: root/lib/puppet
diff options
context:
space:
mode:
authorLuchian Nemes <luchian.nemes@puppet.com>2020-09-03 09:37:21 +0300
committerLuchian Nemes <luchian.nemes@puppet.com>2020-09-03 11:57:31 +0300
commit897ca7a86b9595761e1492a4ffa36bbdb751a15a (patch)
tree9ece0c496112da6826e135002fa181f4c0f15ef9 /lib/puppet
parente2512df5a3cf3113110f40a826970111097323bb (diff)
downloadpuppet-augeas_core-897ca7a86b9595761e1492a4ffa36bbdb751a15a.tar.gz
puppet-augeas_core-897ca7a86b9595761e1492a4ffa36bbdb751a15a.tar.bz2
(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.
Diffstat (limited to 'lib/puppet')
-rw-r--r--lib/puppet/provider/augeas/augeas.rb14
1 files changed, 12 insertions, 2 deletions
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(':')