Merge pull request #208 from apenney/ppa-debian

Ensure apt::ppa fails on non-Ubuntu.
This commit is contained in:
Ashley Penney 2014-01-09 15:28:20 -08:00
commit 1ce7dbb4c3
3 changed files with 10 additions and 3 deletions

View file

@ -1,2 +1 @@
require 'puppetlabs_spec_helper/rake_tasks'
require 'rspec-system/rake_task'

View file

@ -14,6 +14,10 @@ define apt::ppa(
fail('lsbdistcodename fact not available: release parameter required')
}
if $::operatingsystem != 'Ubuntu' {
fail("apt::ppa is currently supported on Ubuntu only.")
}
$filename_without_slashes = regsubst($name, '/', '-', 'G')
$filename_without_dots = regsubst($filename_without_slashes, '\.', '_', 'G')
$filename_without_ppa = regsubst($filename_without_dots, '^ppa:', '', 'G')

View file

@ -2,9 +2,11 @@ require 'spec_helper'
describe 'apt::ppa', :type => :define do
[ { :lsbdistrelease => '11.04',
:lsbdistcodename => 'natty',
:operatingsystem => 'Ubuntu',
:package => 'python-software-properties'},
{ :lsbdistrelease => '12.10',
:lsbdistcodename => 'quantal',
:operatingsystem => 'Ubuntu',
:package => 'software-properties-common'},
].each do |platform|
context "on #{platform[:lsbdistcodename]}" do
@ -12,6 +14,7 @@ describe 'apt::ppa', :type => :define do
{
:lsbdistrelease => platform[:lsbdistrelease],
:lsbdistcodename => platform[:lsbdistcodename],
:operatingsystem => platform[:operatingsystem],
}
end
let :release do
@ -109,7 +112,7 @@ describe 'apt::ppa', :type => :define do
end
end
[ { :lsbdistcodename => 'natty',
[ { :lsbdistcodename => 'natty',
:package => 'python-software-properties' },
{ :lsbdistcodename => 'quantal',
:package => 'software-properties-common'},
@ -121,7 +124,8 @@ describe 'apt::ppa', :type => :define do
'package { "#{platform[:package]}": }->Apt::Ppa["ppa"]'
end
let :facts do
{:lsbdistcodename => '#{platform[:lsbdistcodename]}'}
{:lsbdistcodename => '#{platform[:lsbdistcodename]}',
:operatingsystem => 'Ubuntu'}
end
let(:title) { "ppa" }
let(:release) { "#{platform[:lsbdistcodename]}" }