Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle lense_dir based on $::rubysitedir. #67

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
default: { fail("Unsupported OS family: ${::osfamily}") }
}

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/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is misplaced, the facts hash is not available here

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/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

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