From: Richard Pijnenburg Date: Fri, 7 Mar 2014 15:03:44 +0000 (+0100) Subject: Fail early when its not debian or ubuntu ( or debian like distro ) X-Git-Tag: 1.5.0~21^2 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=4d0bf7cbab1fc9c9fd0ff174315e69262cfe5f68;p=puppet-modules%2Fpuppetlabs-apt.git Fail early when its not debian or ubuntu ( or debian like distro ) --- diff --git a/manifests/init.pp b/manifests/init.pp index 12db61a..ad3f5e0 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -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 diff --git a/spec/acceptance/unsupported_spec.rb b/spec/acceptance/unsupported_spec.rb index 08dca76..3f74685 100644 --- a/spec/acceptance/unsupported_spec.rb +++ b/spec/acceptance/unsupported_spec.rb @@ -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 diff --git a/spec/classes/apt_spec.rb b/spec/classes/apt_spec.rb index 0da7d32..8bace9b 100644 --- a/spec/classes/apt_spec.rb +++ b/spec/classes/apt_spec.rb @@ -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, diff --git a/spec/classes/debian_testing_spec.rb b/spec/classes/debian_testing_spec.rb index 2048733..6e03326 100644 --- a/spec/classes/debian_testing_spec.rb +++ b/spec/classes/debian_testing_spec.rb @@ -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/", diff --git a/spec/classes/debian_unstable_spec.rb b/spec/classes/debian_unstable_spec.rb index 70724f9..8477a39 100644 --- a/spec/classes/debian_unstable_spec.rb +++ b/spec/classes/debian_unstable_spec.rb @@ -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/", diff --git a/spec/classes/params_spec.rb b/spec/classes/params_spec.rb index 5c43bc6..aa330bb 100644 --- a/spec/classes/params_spec.rb +++ b/spec/classes/params_spec.rb @@ -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 } diff --git a/spec/defines/ppa_spec.rb b/spec/defines/ppa_spec.rb index 0c3bd75..6944f9b 100644 --- a/spec/defines/ppa_spec.rb +++ b/spec/defines/ppa_spec.rb @@ -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]}" }