]> review.fuel-infra Code Review - puppet-modules/puppetlabs-apt.git/commitdiff
Merge branch '1.6.x' into test
authorMorgan Haskel <morgan@puppetlabs.com>
Fri, 12 Sep 2014 21:24:49 +0000 (17:24 -0400)
committerMorgan Haskel <morgan@puppetlabs.com>
Fri, 12 Sep 2014 21:24:49 +0000 (17:24 -0400)
.travis.yml
README.md
manifests/backports.pp
manifests/init.pp
manifests/params.pp
manifests/ppa.pp
spec/classes/backports_spec.rb
spec/spec_helper_acceptance.rb

index a40ae502e961b7c077a828bf8601c13b8d2fe5fc..66e90e38df88ce1b76267e2716398459b39b88ee 100644 (file)
@@ -6,9 +6,7 @@ matrix:
   fast_finish: true
   include:
   - rvm: 1.8.7
-    env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.6.0"
-  - rvm: 1.8.7
-    env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.7.0"
+    env: PUPPET_GEM_VERSION="~> 3.0"
   - rvm: 1.9.3
     env: PUPPET_GEM_VERSION="~> 3.0"
   - rvm: 2.0.0
index 9f3bbbe7b762d13417c70eab8f0af4c78830974e..6badc1a43fe7bb9e3f26caa943b1f21fc77dd407 100644 (file)
--- a/README.md
+++ b/README.md
@@ -85,7 +85,7 @@ this module.
 
     apt_key { 'puppetlabs':
       ensure => 'present',
-      id     => '4BD6EC30',
+      id     => '1054B7A24BD6EC30',
     }
 
 You can additionally set the following attributes:
@@ -105,12 +105,12 @@ uses the aforementioned `apt_key` native type. As such it no longer requires
 the wget command that the old implementation depended on.
 
     apt::key { 'puppetlabs':
-      key        => '4BD6EC30',
+      key        => '1054B7A24BD6EC30',
       key_server => 'pgp.mit.edu',
     }
 
     apt::key { 'jenkins':
-      key        => 'D50582E6',
+      key        => '9B7D32F2D50582E6',
       key_source => 'http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key',
     }
 
@@ -199,7 +199,7 @@ Adds an apt source to `/etc/apt/sources.list.d/`.
       release           => 'unstable',
       repos             => 'main contrib non-free',
       required_packages => 'debian-keyring debian-archive-keyring',
-      key               => '46925553',
+      key               => '8B48AD6246925553',
       key_server        => 'subkeys.pgp.net',
       pin               => '-10',
       include_src       => true,
@@ -211,7 +211,7 @@ If you would like to configure your system so the source is the Puppet Labs APT
     apt::source { 'puppetlabs':
       location   => 'http://apt.puppetlabs.com',
       repos      => 'main',
-      key        => '4BD6EC30',
+      key        => '1054B7A24BD6EC30',
       key_server => 'pgp.mit.edu',
     }
 
@@ -231,7 +231,7 @@ apt::sources:
       release: 'unstable'
       repos: 'main contrib non-free'
       required_packages: 'debian-keyring debian-archive-keyring'
-      key: '55BE302B'
+      key: '9AA38DCD55BE302B'
       key_server: 'subkeys.pgp.net'
       pin: '-10'
       include_src: 'true'
@@ -240,7 +240,7 @@ apt::sources:
   'puppetlabs':
       location: 'http://apt.puppetlabs.com'
       repos: 'main'
-      key: '4BD6EC30'
+      key: '1054B7A24BD6EC30'
       key_server: 'pgp.mit.edu'
 </pre>
 
@@ -255,7 +255,7 @@ This test will set up a Puppet Labs apt repository. Start by creating a new smok
     apt::source { 'puppetlabs':
       location   => 'http://apt.puppetlabs.com',
       repos      => 'main',
-      key        => '4BD6EC30',
+      key        => '1054B7A24BD6EC30',
       key_server => 'pgp.mit.edu',
     }
 
index eafa50692e54bf22ee229baca975ccf4bc282a6a..ee462094d4a1f037b1c0d6a090054fd58313c8c6 100644 (file)
@@ -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',
   }
index 1c318b67ca979259ef79933b6b0faf2dedb85f7d..eb8c709babcbefb020ecad42c9f736216f1ec232 100644 (file)
@@ -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.
index d57b80110c8209d4511a722120096a7ae721a4b2..d33a401fe6df214ff93c85bccb83635ed7e27e1b 100644 (file)
@@ -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})")
-    }
   }
 }
index 5f5c6ae57421993afa99705d3d63b6de081fd066..0fdcc95f3a9902ea7f1335a6219823e146f7dc48 100644 (file)
@@ -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],
         ],
index 2f67aa4bc02c71eadafef8a2cc01e068ad453059..17c86ebbba0a60d9aaed90a95f7555a84c592232 100644 (file)
@@ -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
index fe3e4bf0c991ccced1f180cf1dfd3fd9b4df2a82..fd1f2c56b9c0167498523d675a46a1ec433dcdd4 100644 (file)
@@ -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