Merge pull request #350 from cmurphy/master
authorDaniele Sluijters <github@daenney.net>
Sun, 7 Sep 2014 09:56:32 +0000 (11:56 +0200)
committerDaniele Sluijters <github@daenney.net>
Sun, 7 Sep 2014 09:56:32 +0000 (11:56 +0200)
Remove Puppet 2.7 from travis matrix

manifests/backports.pp
manifests/init.pp
manifests/params.pp
manifests/ppa.pp
spec/classes/backports_spec.rb
spec/spec_helper_acceptance.rb

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 3352564ce7b553672fab7dafa8f277af232a065f..6627cf764be0980320f27ed56142c86769f8586e 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