Skip to content

Commit

Permalink
Merge pull request #248 from electrical/fix_params_fail
Browse files Browse the repository at this point in the history
Fix fail message
  • Loading branch information
hunner committed Mar 7, 2014
2 parents 6f10890 + 4d0bf7c commit 6691c2f
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 7 deletions.
4 changes: 4 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
$sources = undef
) {

if $::osfamily != 'Debian' {
fail('This module only works on Debian or derivatives like Ubuntu')
}

include apt::params
include apt::update

Expand Down
2 changes: 1 addition & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
}
}
default: {
fail("Unsupported osfamily (${::osfamily}) or lsbdistid (${::lsbdistid})")
fail("Unsupported lsbdistid (${::lsbdistid})")
}
}
}
2 changes: 1 addition & 1 deletion spec/acceptance/unsupported_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
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
2 changes: 1 addition & 1 deletion spec/classes/apt_spec.rb
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/debian_testing_spec.rb
Original file line number Diff line number Diff line change
@@ -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/",
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/debian_unstable_spec.rb
Original file line number Diff line number Diff line change
@@ -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/",
Expand Down
15 changes: 14 additions & 1 deletion spec/classes/params_spec.rb
Original file line number Diff line number Diff line change
@@ -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 }
Expand All @@ -11,4 +11,17 @@
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
4 changes: 3 additions & 1 deletion spec/defines/ppa_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
:lsbdistcodename => platform[:lsbdistcodename],
:operatingsystem => platform[:operatingsystem],
:lsbdistid => platform[:lsbdistid],
:osfamily => 'Debian',
}
end
let :release do
Expand Down Expand Up @@ -134,7 +135,8 @@
let :facts do
{:lsbdistcodename => '#{platform[:lsbdistcodename]}',
:operatingsystem => 'Ubuntu',
:lsbdistid => 'Ubuntu'}
:lsbdistid => 'Ubuntu',
:osfamily => 'Debian'}
end
let(:title) { "ppa" }
let(:release) { "#{platform[:lsbdistcodename]}" }
Expand Down

0 comments on commit 6691c2f

Please sign in to comment.