Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix fail message #248

Merged
merged 3 commits into from
Mar 7, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
$update_timeout = 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