From 904fb4a2937932b4e24b526583bd563ee549fb14 Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Thu, 20 Feb 2014 16:43:48 -0800 Subject: [PATCH] Don't pass options to ppa on lucid Lucid (10.04) has `add-apt-repository` but it doesn't accept any options. The define defaulted to `-y` but this changes that on lucid. This was made 7 months ago, so apparently no one cares about 10.04 any more. --- manifests/params.pp | 8 +++- manifests/ppa.pp | 2 +- spec/acceptance/apt_ppa_spec.rb | 46 +++++++++---------- .../nodesets/ubuntu-server-10044-x64.yml | 11 +++++ spec/spec_helper_acceptance.rb | 7 +-- 5 files changed, 46 insertions(+), 28 deletions(-) create mode 100644 spec/acceptance/nodesets/ubuntu-server-10044-x64.yml diff --git a/manifests/params.pp b/manifests/params.pp index 955954f..ae46443 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -21,11 +21,17 @@ class apt::params { } 'ubuntu': { case $::lsbdistcodename { - 'hardy','lucid','maverick','natty','oneiric','precise': { + 'hardy','maverick','natty','oneiric','precise': { $backports_location = 'http://us.archive.ubuntu.com/ubuntu' + $ppa_options = 'y' + } + 'lucid': { + $backports_location = 'http://us.archive.ubuntu.com/ubuntu' + $ppa_options = undef } default: { $backports_location = 'http://old-releases.ubuntu.com/ubuntu' + $ppa_options = 'y' } } } diff --git a/manifests/ppa.pp b/manifests/ppa.pp index caff436..7ec6b20 100644 --- a/manifests/ppa.pp +++ b/manifests/ppa.pp @@ -2,7 +2,7 @@ define apt::ppa( $release = $::lsbdistcodename, - $options = '-y' + $options = $apt::params::ppa_options, ) { $ensure = 'present' include apt::params diff --git a/spec/acceptance/apt_ppa_spec.rb b/spec/acceptance/apt_ppa_spec.rb index 2b156bc..60e6d4d 100644 --- a/spec/acceptance/apt_ppa_spec.rb +++ b/spec/acceptance/apt_ppa_spec.rb @@ -27,14 +27,13 @@ if fact('operatingsystem') == 'Ubuntu' end end - context 'readding a removed ppa.' do + context 'reading 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') + shell('echo > /etc/apt/sources.list.d/raravena80-collectd5-$(lsb_release -c -s).list') end - it 'should readd it successfully' do + it 'should read it successfully' do pp = <<-EOS include '::apt' apt::ppa { 'ppa:raravena80/collectd5': } @@ -71,30 +70,31 @@ if fact('operatingsystem') == 'Ubuntu' end end - context 'options' do - context '-y' do - it 'works without failure' do - pp = <<-EOS - include '::apt' - apt::ppa { 'ppa:canonical-kernel-team/ppa': - release => precise, - options => '-y', - } - EOS + if ! default[:platform].match(/10\.04/) + context 'options' do + context '-y' do + it 'works without failure' do + pp = <<-EOS + include '::apt' + apt::ppa { 'ppa:canonical-kernel-team/ppa': + release => precise, + options => '-y', + } + EOS - shell('rm -rf /etc/apt/sources.list.d/canonical-kernel-team-ppa*', :acceptable_exit_codes => [0,1,2]) - apply_manifest(pp, :catch_failures => true) - end + shell('rm -rf /etc/apt/sources.list.d/canonical-kernel-team-ppa*', :acceptable_exit_codes => [0,1,2]) + apply_manifest(pp, :catch_failures => true) + end - describe file('/etc/apt/sources.list.d/canonical-kernel-team-ppa-precise.list') do - it { should be_file } + describe file('/etc/apt/sources.list.d/canonical-kernel-team-ppa-precise.list') do + it { should be_file } + end end end - end - context 'reset' do - it { shell('rm -rf /etc/apt/sources.list.d/canonical-kernel-team-ppa*', :acceptable_exit_codes => [0,1,2]) } + context 'reset' do + it { shell('rm -rf /etc/apt/sources.list.d/canonical-kernel-team-ppa*', :acceptable_exit_codes => [0,1,2]) } + end end - end end diff --git a/spec/acceptance/nodesets/ubuntu-server-10044-x64.yml b/spec/acceptance/nodesets/ubuntu-server-10044-x64.yml new file mode 100644 index 0000000..c1b8bdf --- /dev/null +++ b/spec/acceptance/nodesets/ubuntu-server-10044-x64.yml @@ -0,0 +1,11 @@ +HOSTS: + ubuntu-server-10044-x64: + roles: + - master + platform: ubuntu-10.04-amd64 + box : ubuntu-server-10044-x64-vbox4210-nocm + box_url : http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-10044-x64-vbox4210-nocm.box + hypervisor : vagrant +CONFIG: + log_level: debug + type: git diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 55c2fd4..37afbfc 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -1,18 +1,19 @@ require 'beaker-rspec' +# Install Puppet unless ENV['RS_PROVISION'] == 'no' hosts.each do |host| - # Install Puppet if host.is_pe? install_pe else - install_package host, 'rubygems' - on host, 'gem install puppet --no-ri --no-rdoc' + install_puppet on host, "mkdir -p #{host['distmoduledir']}" end end end +UNSUPPORTED_PLATFORMS = ['windows','aix','solaris',/el-(4|5|6)/] + RSpec.configure do |c| # Project root proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))