Skip to content

Commit

Permalink
Handle lense_dir based on $::rubysitedir. (#87)
Browse files Browse the repository at this point in the history
Fixes: #65
  • Loading branch information
bzed authored Aug 27, 2021
1 parent a418f23 commit 1ff219f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
default: { fail("Unsupported OS family: ${facts['os']['family']}") }
}

if versioncmp($::puppetversion, '4.0.0') >= 0 {
if (versioncmp($::puppetversion, '4.0.0') >= 0) and ($::rubysitedir =~ /\/opt\/puppetlabs\/puppet/) {
$lens_dir = '/opt/puppetlabs/puppet/share/augeas/lenses'
} elsif (defined('$is_pe') and str2bool("${::is_pe}")) { # lint:ignore:only_variable_string
# puppet enterpise has a different lens location
Expand Down
6 changes: 5 additions & 1 deletion spec/classes/augeas_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@
end
end

lens_dir = (Puppet.version < '4.0.0') ? '/usr/share/augeas/lenses' : '/opt/puppetlabs/puppet/share/augeas/lenses'
if Puppet.version >= '4.0.0' and facts[:rubysitedir] =~ /\/opt\/puppetlabs\/puppet/
lens_dir = '/opt/puppetlabs/puppet/share/augeas/lenses'
else
lens_dir = '/usr/share/augeas/lenses'
end

on_supported_os.each do |os, facts|
context "on #{os}" do
Expand Down
6 changes: 5 additions & 1 deletion spec/defines/augeas_lens_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
describe 'augeas::lens' do
let(:title) { 'foo' }

lens_dir = (Puppet.version < '4.0.0') ? '/usr/share/augeas/lenses' : '/opt/puppetlabs/puppet/share/augeas/lenses'
if Puppet.version >= '4.0.0' and facts[:rubysitedir] =~ /\/opt\/puppetlabs\/puppet/
lens_dir = '/opt/puppetlabs/puppet/share/augeas/lenses'
else
lens_dir = '/usr/share/augeas/lenses'
end

context 'when declaring augeas class first' do
on_supported_os.each do |os, facts|
Expand Down

0 comments on commit 1ff219f

Please sign in to comment.