From: Daniele Sluijters Date: Sun, 7 Sep 2014 09:56:32 +0000 (+0200) Subject: Merge pull request #350 from cmurphy/master X-Git-Tag: 1.7.0~10 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=29e6e09d7a91ddf25f624419e9e0b9a0fe49d4de;hp=018a31a0ecf3020d74928363c88b8fa160eea14a;p=puppet-modules%2Fpuppetlabs-apt.git Merge pull request #350 from cmurphy/master Remove Puppet 2.7 from travis matrix --- diff --git a/manifests/backports.pp b/manifests/backports.pp index eafa506..ee46209 100644 --- a/manifests/backports.pp +++ b/manifests/backports.pp @@ -38,12 +38,30 @@ class apt::backports( fail('$pin_priority must be an integer') } - $release_real = downcase($release) - $key = $::lsbdistid ? { + if $::lsbdistid == 'LinuxMint' { + if $::lsbdistcodename == 'debian' { + $distid = 'debian' + $release_real = 'wheezy' + } else { + $distid = 'ubuntu' + $release_real = $::lsbdistcodename ? { + 'qiana' => 'trusty', + 'petra' => 'saucy', + 'olivia' => 'raring', + 'nadia' => 'quantal', + 'maya' => 'precise', + } + } + } else { + $distid = $::lsbdistid + $release_real = downcase($release) + } + + $key = $distid ? { 'debian' => '46925553', 'ubuntu' => '437D05B5', } - $repos = $::lsbdistid ? { + $repos = $distid ? { 'debian' => 'main contrib non-free', 'ubuntu' => 'main universe multiverse restricted', } diff --git a/manifests/init.pp b/manifests/init.pp index 1c318b6..eb8c709 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -89,8 +89,8 @@ class apt( if $purge_preferences { file { 'apt-preferences': - ensure => absent, - path => "${root}/preferences", + ensure => absent, + path => "${root}/preferences", } } @@ -113,8 +113,8 @@ class apt( } false: { file { '99progressbar': - ensure => absent, - path => "${apt_conf_d}/99progressbar", + ensure => absent, + path => "${apt_conf_d}/99progressbar", } } undef: {} # do nothing @@ -142,9 +142,9 @@ class apt( case $proxy_host { false, '', undef: { file { '01proxy': - ensure => absent, - path => "${apt_conf_d}/01proxy", - notify => Exec['apt_update'], + ensure => absent, + path => "${apt_conf_d}/01proxy", + notify => Exec['apt_update'], } } default: { @@ -161,9 +161,9 @@ class apt( } file { 'old-proxy-file': - ensure => absent, - path => "${apt_conf_d}/proxy", - notify => Exec['apt_update'], + ensure => absent, + path => "${apt_conf_d}/proxy", + notify => Exec['apt_update'], } # Need anchor to provide containment for dependencies. diff --git a/manifests/params.pp b/manifests/params.pp index d57b801..d33a401 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -6,14 +6,41 @@ class apt::params { $preferences_d = "${root}/preferences.d" case $::lsbdistid { + 'ubuntu', 'debian': { + $distid = $::lsbdistid + $distcodename = $::lsbdistcodename + } + 'linuxmint': { + if $::lsbdistcodename == 'debian' { + $distid = 'debian' + $distcodename = 'wheezy' + } else { + $distid = 'ubuntu' + $distcodename = $::lsbdistcodename ? { + 'qiana' => 'trusty', + 'petra' => 'saucy', + 'olivia' => 'raring', + 'nadia' => 'quantal', + 'maya' => 'precise', + } + } + } + '': { + fail('Unable to determine lsbdistid, is lsb-release installed?') + } + default: { + fail("Unsupported lsbdistid (${::lsbdistid})") + } + } + case $distid { 'debian': { - case $::lsbdistcodename { + case $distcodename { 'squeeze': { $backports_location = 'http://backports.debian.org/debian-backports' $legacy_origin = true - $origins = ['${distro_id} oldstable', - '${distro_id} ${distro_codename}-security', - '${distro_id} ${distro_codename}-lts'] + $origins = ['${distro_id} oldstable', #lint:ignore:single_quote_string_with_variables + '${distro_id} ${distro_codename}-security', #lint:ignore:single_quote_string_with_variables + '${distro_id} ${distro_codename}-lts'] #lint:ignore:single_quote_string_with_variables } 'wheezy': { $backports_location = 'http://ftp.debian.org/debian/' @@ -28,32 +55,26 @@ class apt::params { } } 'ubuntu': { - case $::lsbdistcodename { + case $distcodename { 'lucid': { $backports_location = 'http://us.archive.ubuntu.com/ubuntu' $ppa_options = undef $legacy_origin = true - $origins = ['${distro_id} ${distro_codename}-security'] + $origins = ['${distro_id} ${distro_codename}-security'] #lint:ignore:single_quote_string_with_variables } 'precise', 'trusty': { $backports_location = 'http://us.archive.ubuntu.com/ubuntu' $ppa_options = '-y' $legacy_origin = true - $origins = ['${distro_id}:${distro_codename}-security'] + $origins = ['${distro_id}:${distro_codename}-security'] #lint:ignore:single_quote_string_with_variables } default: { $backports_location = 'http://old-releases.ubuntu.com/ubuntu' $ppa_options = '-y' $legacy_origin = true - $origins = ['${distro_id}:${distro_codename}-security'] + $origins = ['${distro_id}:${distro_codename}-security'] #lint:ignore:single_quote_string_with_variables } } } - '': { - fail('Unable to determine lsbdistid, is lsb-release installed?') - } - default: { - fail("Unsupported lsbdistid (${::lsbdistid})") - } } } diff --git a/manifests/ppa.pp b/manifests/ppa.pp index 5f5c6ae..0fdcc95 100644 --- a/manifests/ppa.pp +++ b/manifests/ppa.pp @@ -48,13 +48,13 @@ define apt::ppa( $proxy_env = [] } exec { "add-apt-repository-${name}": - environment => $proxy_env, - command => "/usr/bin/add-apt-repository ${options} ${name}", - unless => "/usr/bin/test -s ${sources_list_d}/${sources_list_d_filename}", - user => 'root', - logoutput => 'on_failure', - notify => Exec['apt_update'], - require => [ + environment => $proxy_env, + command => "/usr/bin/add-apt-repository ${options} ${name}", + unless => "/usr/bin/test -s ${sources_list_d}/${sources_list_d_filename}", + user => 'root', + logoutput => 'on_failure', + notify => Exec['apt_update'], + require => [ File['sources.list.d'], Package[$package], ], diff --git a/spec/classes/backports_spec.rb b/spec/classes/backports_spec.rb index 2f67aa4..17c86eb 100644 --- a/spec/classes/backports_spec.rb +++ b/spec/classes/backports_spec.rb @@ -71,6 +71,46 @@ describe 'apt::backports', :type => :class do } end + describe "when turning on backports for linux mint debian edition" do + + let :facts do + { + 'lsbdistcodename' => 'debian', + 'lsbdistid' => 'LinuxMint', + } + end + + it { should contain_apt__source('backports').with({ + 'location' => 'http://ftp.debian.org/debian/', + 'release' => 'wheezy-backports', + 'repos' => 'main contrib non-free', + 'key' => '46925553', + 'key_server' => 'pgp.mit.edu', + 'pin' => 200, + }) + } + end + + describe "when turning on backports for linux mint 17 (ubuntu-based)" do + + let :facts do + { + 'lsbdistcodename' => 'qiana', + 'lsbdistid' => 'LinuxMint', + } + end + + it { should contain_apt__source('backports').with({ + 'location' => 'http://us.archive.ubuntu.com/ubuntu', + 'release' => 'trusty-backports', + 'repos' => 'main universe multiverse restricted', + 'key' => '437D05B5', + 'key_server' => 'pgp.mit.edu', + 'pin' => 200, + }) + } + end + describe "when turning on backports for debian squeeze but using your own mirror" do let :facts do diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 3352564..6627cf7 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -2,13 +2,14 @@ require 'beaker-rspec' # Install Puppet unless ENV['RS_PROVISION'] == 'no' + # This will install the latest available package on el and deb based + # systems fail on windows and osx, and install via gem on other *nixes + foss_opts = { :default_action => 'gem_install' } + + if default.is_pe?; then install_pe; else install_puppet( foss_opts ); end + hosts.each do |host| - if host.is_pe? - install_pe - else - install_puppet - on host, "mkdir -p #{host['distmoduledir']}" - end + on host, "mkdir -p #{host['distmoduledir']}" end end