From: Spencer Owen Date: Thu, 10 Jul 2014 17:48:54 +0000 (-0600) Subject: Adds check to params.pp if lab-release is not installed X-Git-Tag: 1.6.0~9^2 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=64b8eb1e4a67e0d7515b2aa971564c08ef8903be;p=puppet-modules%2Fpuppetlabs-apt.git 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 --- diff --git a/manifests/params.pp b/manifests/params.pp index f635b58..d57b801 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -49,6 +49,9 @@ class apt::params { } } } + '': { + fail('Unable to determine lsbdistid, is lsb-release installed?') + } default: { fail("Unsupported lsbdistid (${::lsbdistid})") } diff --git a/spec/classes/params_spec.rb b/spec/classes/params_spec.rb index aa330bb..d85e849 100644 --- a/spec/classes/params_spec.rb +++ b/spec/classes/params_spec.rb @@ -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