From 744dd5903e607294a9d9b68081c6852311293ae6 Mon Sep 17 00:00:00 2001
From: Adam Henry Lewenberg <adamhl@stanford.edu>
Date: Sun, 11 Dec 2016 08:19:35 -0800
Subject: [PATCH] fix type comparison error and add option to not include a
 backports repo

---
 NEWS                                   | 14 ++++++++++----
 manifests/os/debian.pp                 | 14 +++++++++++---
 templates/ipmi/etc/default/ipmievd.erb |  2 +-
 templates/os/sources/stanford.list.erb |  3 ++-
 4 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/NEWS b/NEWS
index 331bc5c..7d95ca3 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,4 @@
-release/005.001 (2016-12-07)
+release/005.001 (2016-12-11)
 
     Add "path" attributes to several exec resources. This will be required
     in the next version of Puppet. [adamhl]
@@ -12,11 +12,14 @@ release/005.001 (2016-12-07)
     [puppetclient] Remove some conditional code that made sense when we
     used very old versions of Puppet. [adamhl]
 
-    [ssh] More of the instance variable cleanup. [adamhl]
+    [ssh, syslog, xinetd] More instance variable cleanup. [adamhl]
 
-    [syslog] More of the instance variable cleanup. [adamhl]
+    [ipmi] When comparing lsbmajdistrelease to a Debian version, convert
+    lsbmajdistrelease to an integer first (otherwise, get Ruby
+    error). [adamhl]
 
-    [xinetd] More of the instance variable cleanup. [adamhl]
+    [os/debian] Add parameter to allow the option of *not* including the
+    debian-stanford backports repository in the apt sources. [adamhl]
 
 release/005.000 (2016-11-21)
 
@@ -55,6 +58,9 @@ release/005.000 (2016-11-21)
     * apt_cache_tmp_dir.  When apt_cache_notin_tmp is true, this is the
     directory to use for package scripts.
 
+    [os/debian] Install the stanford-server package (this might trigger a
+    duplicate resource error if currently installed by other classes).
+
     [postfix/sender] A new type: base::postfix::sender.  This is similar to
     base::postfix::recipient, except it is used to rewrite sender addresses
     instead of recipient addresses.
diff --git a/manifests/os/debian.pp b/manifests/os/debian.pp
index 12d6839..8a110a9 100644
--- a/manifests/os/debian.pp
+++ b/manifests/os/debian.pp
@@ -13,7 +13,7 @@
 #
 # $apt_cache_notin_tmp: If you want apt to use a directory other than
 # /tmp for its temporary cache, set this parameter to "true". This is needed
-# if the /tmp partition is set to "noexec" (apt often needs to execture
+# if the /tmp partition is set to "noexec" (apt often needs to execute
 # configuration files as part of an install or uninstall).
 #
 # If $apt_cache_notin_tmp is set to "true" and $apt_cache_directory is
@@ -29,10 +29,18 @@
 # NOTE! If you use $apt_cache_tmp_dir to override the default, then you
 # must have $apt_cache_tmp_dir as a file resource in your own Puppet
 # code, otherwise Puppet will fail.
+#
+# $debian_stanford_backports: if set to true (the default) will include in
+# apt sources the debian-stanford backports repository. There are some
+# packages in the debian-stanford backports repository that overlap the
+# regular debian repository, so some users may not want to use this extra
+# source; in that case, they should set this parameter to false.
+# Default: true
 
 class base::os::debian (
-  $apt_cache_notin_tmp = false,
-  $apt_cache_tmp_dir   = '/var/cache/apt/tmp'
+  $apt_cache_notin_tmp       = false,
+  $apt_cache_tmp_dir         = '/var/cache/apt/tmp',
+  $debian_stanford_backports = true
 ){
   include base::newsyslog
 
diff --git a/templates/ipmi/etc/default/ipmievd.erb b/templates/ipmi/etc/default/ipmievd.erb
index acfff56..ca8a515 100644
--- a/templates/ipmi/etc/default/ipmievd.erb
+++ b/templates/ipmi/etc/default/ipmievd.erb
@@ -1,6 +1,6 @@
 ENABLED=true
 
-<% if ((@operatingsystem == 'Debian' and @lsbmajdistrelease >= 8) \
+<% if ((@operatingsystem == 'Debian' and @lsbmajdistrelease.to_i >= 8) \
        or (@operatingsystem == 'Ubuntu' and !@lsbmajdistrelease.split('.')[0].nil? and @lsbmajdistrelease.split('.')[0].to_i >= 14))
 %>
 IPMIEVD_OPTIONS="open daemon"
diff --git a/templates/os/sources/stanford.list.erb b/templates/os/sources/stanford.list.erb
index 4411d95..cc2ae1c 100644
--- a/templates/os/sources/stanford.list.erb
+++ b/templates/os/sources/stanford.list.erb
@@ -24,7 +24,8 @@ deb-src http://debian.stanford.edu/debian-stanford <%= dist %> main non-free con
 # The Stanford restricted Debian archive and source tree.
 deb     http://debian.stanford.edu/debian-local <%= dist %> main non-free contrib
 deb-src http://debian.stanford.edu/debian-local <%= dist %> main non-free contrib
-<% if @lsbdistcodename == 'wheezy' || @lsbdistcodename == 'jessie' || @operatingsystem == 'Ubuntu' -%>
+<% if (@debian_stanford_backports) &&
+  (@lsbdistcodename == 'wheezy' || @lsbdistcodename == 'jessie' || @operatingsystem == 'Ubuntu') -%>
 
 # Additional Stanford-local backports.
 deb     http://debian.stanford.edu/debian-stanford <%= dist %>-backports main non-free contrib
-- 
GitLab