]> review.fuel-infra Code Review - puppet-modules/puppetlabs-apt.git/commitdiff
Fail early when its not debian or ubuntu ( or debian like distro )
authorRichard Pijnenburg <richard@ispavailability.com>
Fri, 7 Mar 2014 15:03:44 +0000 (16:03 +0100)
committerRichard Pijnenburg <richard@ispavailability.com>
Fri, 7 Mar 2014 15:03:44 +0000 (16:03 +0100)
manifests/init.pp
spec/acceptance/unsupported_spec.rb
spec/classes/apt_spec.rb
spec/classes/debian_testing_spec.rb
spec/classes/debian_unstable_spec.rb
spec/classes/params_spec.rb
spec/defines/ppa_spec.rb

index 12db61a6df3b1c9080584436a02cc490e86e82a7..ad3f5e06e03cb4a38ff5f5e32e4e379c8df373d1 100644 (file)
@@ -34,6 +34,10 @@ class apt(
   $update_timeout       = undef
 ) {
 
+  if $::osfamily != 'Debian' {
+    fail('This module only works on Debian or derivatives like Ubuntu')
+  }
+
   include apt::params
   include apt::update
 
index 08dca76b845390cd3e3a4444240db9b6682ebe17..3f7468530b91728f99cee6a59d4b0ef17b8b6b72 100644 (file)
@@ -5,6 +5,6 @@ describe 'unsupported distributions and OSes', :if => UNSUPPORTED_PLATFORMS.incl
     pp = <<-EOS
       class { 'apt': }
     EOS
-    expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/unsupported/i)
+    expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/This module only works on Debian or derivatives like Ubuntu/i)
   end
 end
index 0da7d32db03088751687508d60e594e4f2843619..8bace9b54906fb3dc102bee452c321687899a443 100644 (file)
@@ -1,6 +1,6 @@
 require 'spec_helper'
 describe 'apt', :type => :class do
-  let(:facts) { { :lsbdistid => 'Debian' } }
+  let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian' } }
   let :default_params do
     {
       :disable_keys => :undef,
index 20487333f67ae6b3683998dcd5155c484eb606f5..6e0332652feb24524960e355c8a36ae34bac50fc 100644 (file)
@@ -1,6 +1,6 @@
 require 'spec_helper'
 describe 'apt::debian::testing', :type => :class do
-  let(:facts) { { :lsbdistid => 'Debian' } }
+  let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian' } }
   it {
     should contain_apt__source("debian_testing").with({
       "location"            => "http://debian.mirror.iweb.ca/debian/",
index 70724f90bd04d4fefa5441b516b928edfb461629..8477a39e580a84c084ae9fdc8001b7ebff3afcb4 100644 (file)
@@ -1,6 +1,6 @@
 require 'spec_helper'
 describe 'apt::debian::unstable', :type => :class do
-  let(:facts) { { :lsbdistid => 'Debian' } }
+  let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian' } }
   it {
     should contain_apt__source("debian_unstable").with({
       "location"          => "http://debian.mirror.iweb.ca/debian/",
index 5c43bc64d2c7e8d660170ac749fab8b3e82f5d6c..aa330bb987649ac03eeefc237164b09ad276d3ef 100644 (file)
@@ -1,6 +1,6 @@
 require 'spec_helper'
 describe 'apt::params', :type => :class do
-  let(:facts) { { :lsbdistid => 'Debian' } }
+  let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian' } }
   let (:title) { 'my_package' }
 
   it { should contain_apt__params }
index 0c3bd75ed779dc64c8a9807eac679c9143b4dccf..6944f9b2dfc8f67d951bb3d53a7179759003e4f0 100644 (file)
@@ -23,6 +23,7 @@ describe 'apt::ppa', :type => :define do
           :lsbdistcodename => platform[:lsbdistcodename],
           :operatingsystem => platform[:operatingsystem],
           :lsbdistid       => platform[:lsbdistid],
+          :osfamily        => 'Debian',
         }
       end
       let :release do
@@ -134,7 +135,8 @@ describe 'apt::ppa', :type => :define do
         let :facts do
           {:lsbdistcodename => '#{platform[:lsbdistcodename]}',
            :operatingsystem => 'Ubuntu',
-           :lsbdistid => 'Ubuntu'}
+           :lsbdistid => 'Ubuntu',
+           :osfamily => 'Debian'}
         end
         let(:title) { "ppa" }
         let(:release) { "#{platform[:lsbdistcodename]}" }