Adds check to params.pp if lab-release is not installed

Adds spec test

If lab-release is not installed, then the end user sees a confusing/ vague message
Error: Unsupported lsbdistid () at /modules/apt/manifests/params.pp:52
It is common for docker containers to not include this package by default

After fix, the user sees a friendlier message if lab-release is not installed
Error: Unable to determine lsbdistid, is lsb-release installed? at /modules/apt/manifests/params.pp:52
This commit is contained in:
Spencer Owen 2014-07-10 11:48:54 -06:00
parent 06b5dc232b
commit 64b8eb1e4a
2 changed files with 15 additions and 0 deletions

View file

@ -49,6 +49,9 @@ class apt::params {
}
}
}
'': {
fail('Unable to determine lsbdistid, is lsb-release installed?')
}
default: {
fail("Unsupported lsbdistid (${::lsbdistid})")
}

View file

@ -24,4 +24,16 @@ describe 'apt::params', :type => :class do
end
end
describe "With lsb-release not installed" do
let(:facts) { { :lsbdistid => '' } }
let (:title) { 'my_package' }
it do
expect {
should compile
}.to raise_error(Puppet::Error, /Unable to determine lsbdistid, is lsb-release installed/)
end
end
end