Adds check to params.pp if lab-release is not installed
authorSpencer Owen <owenspencer@gmail.com>
Thu, 10 Jul 2014 17:48:54 +0000 (11:48 -0600)
committerSpencer Owen <owenspencer@gmail.com>
Thu, 10 Jul 2014 17:48:54 +0000 (11:48 -0600)
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

manifests/params.pp
spec/classes/params_spec.rb

index f635b5801cd98889582d19c088f6923a2708ace0..d57b80110c8209d4511a722120096a7ae721a4b2 100644 (file)
@@ -49,6 +49,9 @@ class apt::params {
         }
       }
     }
+    '': {
+      fail('Unable to determine lsbdistid, is lsb-release installed?')
+    }
     default: {
       fail("Unsupported lsbdistid (${::lsbdistid})")
     }
index aa330bb987649ac03eeefc237164b09ad276d3ef..d85e849d5ae31a370ccce001f274f449608f32f9 100644 (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