]> review.fuel-infra Code Review - puppet-modules/puppetlabs-apt.git/commitdiff
add support for LinuxMint operating system
authorChristophe Bliard <christophe.bliard@smartesting.com>
Fri, 29 Aug 2014 14:23:21 +0000 (16:23 +0200)
committerChristophe Bliard <christophe.bliard@smartesting.com>
Fri, 29 Aug 2014 14:23:21 +0000 (16:23 +0200)
manifests/backports.pp
manifests/params.pp
spec/classes/backports_spec.rb

index eafa50692e54bf22ee229baca975ccf4bc282a6a..c45bc15682de4933f261a01b3827c5c469f202a9 100644 (file)
@@ -38,12 +38,29 @@ class apt::backports(
     fail('$pin_priority must be an integer')
   }
 
-  $release_real = downcase($release)
-  $key = $::lsbdistid ? {
+  if $::lsbdistid == 'LinuxMint' {
+    $distid = $::lsbdistcodename ? {
+      'debian' => 'debian',
+      default  => 'ubuntu',
+    }
+    $release_real = $::lsbdistcodename ? {
+      'debian' => 'wheezy',
+      '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 d57b80110c8209d4511a722120096a7ae721a4b2..20ad8d8dd785263a3e5a43549b2df46844012eae 100644 (file)
@@ -6,8 +6,34 @@ class apt::params {
   $preferences_d  = "${root}/preferences.d"
 
   case $::lsbdistid {
+    'linuxmint': {
+      $distid = $::lsbdistcodename ? {
+        'debian' => 'debian',
+        default  => 'ubuntu',
+      }
+      $distcodename = $::lsbdistcodename ? {
+        'debian' => 'wheezy',
+        'qiana'  => 'trusty',
+        'petra'  => 'saucy',
+        'olivia' => 'raring',
+        'nadia'  => 'quantal',
+        'maya'   => 'precise',
+      }
+    }
+    'ubuntu', 'debian': {
+      $distid = $::lsbdistid
+      $distcodename = $::lsbdistcodename
+    }
+    '': {
+      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
@@ -28,7 +54,7 @@ class apt::params {
       }
     }
     'ubuntu': {
-      case $::lsbdistcodename {
+      case $distcodename {
         'lucid': {
           $backports_location = 'http://us.archive.ubuntu.com/ubuntu'
           $ppa_options        = undef
@@ -49,11 +75,5 @@ class apt::params {
         }
       }
     }
-    '': {
-      fail('Unable to determine lsbdistid, is lsb-release installed?')
-    }
-    default: {
-      fail("Unsupported lsbdistid (${::lsbdistid})")
-    }
   }
 }
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