$sources = undef
) {
+ if $::osfamily != 'Debian' {
+ fail('This module only works on Debian or derivatives like Ubuntu')
+ }
+
include apt::params
include apt::update
}
}
default: {
- fail("Unsupported osfamily (${::osfamily}) or lsbdistid (${::lsbdistid})")
+ fail("Unsupported lsbdistid (${::lsbdistid})")
}
}
}
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
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,
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/",
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/",
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 }
it "Should not contain any resources" do
subject.resources.size.should == 4
end
+
+ describe "With unknown lsbdistid" do
+
+ let(:facts) { { :lsbdistid => 'CentOS' } }
+ let (:title) { 'my_package' }
+
+ it do
+ expect {
+ should compile
+ }.to raise_error(Puppet::Error, /Unsupported lsbdistid/)
+ end
+
+ end
end
:lsbdistcodename => platform[:lsbdistcodename],
:operatingsystem => platform[:operatingsystem],
:lsbdistid => platform[:lsbdistid],
+ :osfamily => 'Debian',
}
end
let :release do
let :facts do
{:lsbdistcodename => '#{platform[:lsbdistcodename]}',
:operatingsystem => 'Ubuntu',
- :lsbdistid => 'Ubuntu'}
+ :lsbdistid => 'Ubuntu',
+ :osfamily => 'Debian'}
end
let(:title) { "ppa" }
let(:release) { "#{platform[:lsbdistcodename]}" }