Merge pull request #169 from apenney/fix_ppa.pp

This switches us to doing a `test -s` instead of checking for the
This commit is contained in:
Ashley Penney 2013-10-02 12:06:32 -07:00
commit 42b2cd3d61
6 changed files with 30 additions and 6 deletions

View file

@ -42,7 +42,7 @@ define apt::ppa(
exec { "add-apt-repository-${name}":
environment => $proxy_env,
command => "/usr/bin/add-apt-repository ${options} ${name}",
creates => "${sources_list_d}/${sources_list_d_filename}",
onlyif => "/usr/bin/test -s ${sources_list_d}/${sources_list_d_filename}",
logoutput => 'on_failure',
notify => Exec['apt_update'],
require => [

View file

@ -45,7 +45,7 @@ describe 'apt::ppa', :type => :define do
it { should contain_exec("add-apt-repository-#{t}").with(
'command' => "/usr/bin/add-apt-repository #{options} #{t}",
'creates' => "/etc/apt/sources.list.d/#{filename}",
'onlyif' => "/usr/bin/test -s /etc/apt/sources.list.d/#{filename}",
'require' => ["File[/etc/apt/sources.list.d]", "Package[#{package}]"],
'notify' => "Exec[apt_update]"
)
@ -74,7 +74,7 @@ describe 'apt::ppa', :type => :define do
it { should contain_exec("add-apt-repository-#{title}").with(
'environment' => [],
'command' => "/usr/bin/add-apt-repository #{options} #{title}",
'creates' => "/etc/apt/sources.list.d/#{filename}",
'onlyif' => "/usr/bin/test -s /etc/apt/sources.list.d/#{filename}",
'require' => ["File[/etc/apt/sources.list.d]", "Package[#{package}]"],
'notify' => "Exec[apt_update]"
)
@ -100,7 +100,7 @@ describe 'apt::ppa', :type => :define do
"https_proxy=http://user:pass@proxy:8080",
],
'command' => "/usr/bin/add-apt-repository #{options} #{title}",
'creates' => "/etc/apt/sources.list.d/#{filename}",
'onlyif' => "/usr/bin/test -s /etc/apt/sources.list.d/#{filename}",
'require' => ["File[/etc/apt/sources.list.d]", "Package[#{package}]"],
'notify' => "Exec[apt_update]"
)

View file

@ -12,6 +12,7 @@ describe 'apt::builddep' do
context 'apt::builddep' do
it 'should work with no errors' do
pp = <<-EOS
include '::apt'
apt::builddep { 'glusterfs-server': }
EOS

View file

@ -12,6 +12,7 @@ describe 'apt::key' do
context 'apt::key' do
it 'should work with no errors' do
pp = <<-EOS
include '::apt'
apt::key { 'puppetlabs':
key => '4BD6EC30',
key_server => 'pgp.mit.edu',

View file

@ -5,10 +5,11 @@ describe 'apt::ppa' do
context 'reset' do
it 'removes ppa' do
shell('rm /etc/apt/sources.list.d/drizzle-developers-ppa*')
shell('rm /etc/apt/sources.list.d/raravena80-collectd5-*')
end
end
context 'apt::ppa' do
context 'adding a ppa that doesnt exist' do
it 'should work with no errors' do
pp = <<-EOS
include '::apt'
@ -29,9 +30,29 @@ describe 'apt::ppa' do
end
end
context 'readding a removed ppa.' do
it 'setup' do
shell('add-apt-repository -y ppa:raravena80/collectd5')
# This leaves a blank file
shell('add-apt-repository --remove ppa:raravena80/collectd5')
end
it 'should readd it successfully' do
pp = <<-EOS
include '::apt'
apt::ppa { 'ppa:raravena80/collectd5': }
EOS
puppet_apply(pp) do |r|
r.exit_code.should_not == 1
end
end
end
context 'reset' do
it 'removes ppa' do
it 'removes added ppas' do
shell('rm /etc/apt/sources.list.d/drizzle-developers-ppa*')
shell('rm /etc/apt/sources.list.d/raravena80-collectd5-*')
end
end

View file

@ -12,6 +12,7 @@ describe 'apt::source' do
context 'apt::source' do
it 'should work with no errors' do
pp = <<-EOS
include '::apt'
apt::source { 'puppetlabs':
location => 'http://apt.puppetlabs.com',
repos => 'main',