Skip to content
Snippets Groups Projects
Verified Commit 2b53d345 authored by Adam Lewenberg's avatar Adam Lewenberg
Browse files

fix numerical comparisons of lsbmajdistrelease

parent 8299f4a7
No related branches found
No related tags found
1 merge request!7Puppet5 lonlone
...@@ -25,7 +25,7 @@ class base::cron( ...@@ -25,7 +25,7 @@ class base::cron(
} }
elsif ($::osfamily == 'RedHat') { elsif ($::osfamily == 'RedHat') {
$crond = 'crond' $crond = 'crond'
if ($::lsbmajdistrelease == '6') { if ($lsbmajdistrelease == '6') {
# OL6 appears to be stuck with cronie-anacron # OL6 appears to be stuck with cronie-anacron
if ($::operatingsystem == 'OracleLinux') { if ($::operatingsystem == 'OracleLinux') {
package { 'cronie-anacron': ensure => present } package { 'cronie-anacron': ensure => present }
......
...@@ -51,10 +51,7 @@ class base::ipmi ( ...@@ -51,10 +51,7 @@ class base::ipmi (
# default. But, if we are re-enabling we need to recover a file that # default. But, if we are re-enabling we need to recover a file that
# we deleted. We then have to trigger systemd to load modules. # we deleted. We then have to trigger systemd to load modules.
# #
# Note: we add 0 to $::lsbmajdistrelease to make the numerical if (($::operatingsystem == 'Debian') and (Integer($lsbmajdistrelease) >= 8)) {
# comparison work (this way, the code works in both Puppet 3 and
# Puppet 4).
if (($::operatingsystem == 'Debian') and (0 + $::lsbmajdistrelease >= 8)) {
exec { 'Re-create /usr/lib/modules-load.d/ipmievd.conf': exec { 'Re-create /usr/lib/modules-load.d/ipmievd.conf':
command => '/usr/bin/apt-get install --reinstall ipmitool', command => '/usr/bin/apt-get install --reinstall ipmitool',
creates => '/usr/lib/modules-load.d/ipmievd.conf', creates => '/usr/lib/modules-load.d/ipmievd.conf',
...@@ -132,7 +129,7 @@ class base::ipmi ( ...@@ -132,7 +129,7 @@ class base::ipmi (
} }
# For RHEL 5 and earlier, the client is a separate package # For RHEL 5 and earlier, the client is a separate package
if $::lsbmajdistrelease <= 5 { if Integer($lsbmajdistrelease) <= 5 {
package { 'OpenIPMI-tools': package { 'OpenIPMI-tools':
ensure => present, ensure => present,
} }
...@@ -233,7 +230,7 @@ class base::ipmi ( ...@@ -233,7 +230,7 @@ class base::ipmi (
} }
# For Debian 8+, make sure modules are not re-loaded on startup # For Debian 8+, make sure modules are not re-loaded on startup
if $::operatingsystem == 'Debian' and $::lsbmajdistrelease >= 8 { if $::operatingsystem == 'Debian' and Integer($lsbmajdistrelease) >= 8 {
file { '/usr/lib/modules-load.d/ipmievd.conf': file { '/usr/lib/modules-load.d/ipmievd.conf':
ensure => absent, ensure => absent,
} }
......
...@@ -38,9 +38,9 @@ class base::ntp { ...@@ -38,9 +38,9 @@ class base::ntp {
}, },
notify => Service['ntpd'], notify => Service['ntpd'],
} }
# On RHEL 8, we expect that systemd-timesync will be present, and not # On RHEL 8, we expect that systemd-timesync will be present, and not
# masked by NTP's installation. So, disbale the service. # masked by NTP's installation. So, disbale the service.
if ( $::lsbmajdistrelease == 8 ) { if ( Integer($lsbmajdistrelease) == 8 ) {
service { 'systemd-timesyncd': service { 'systemd-timesyncd':
ensure => stopped, ensure => stopped,
enable => false, enable => false,
......
# #
# Rules specific to CentOS systems. Very thin class because with # Rules specific to CentOS systems. Very thin class because with
# minor edits to redhat.pp, little additional config is needed # minor edits to redhat.pp, little additional config is needed
class base::os::centos { class base::os::centos {
# redhat.pp can handle most of the heavy lifting for CentOS # redhat.pp can handle most of the heavy lifting for CentOS
...@@ -31,8 +31,8 @@ class base::os::centos { ...@@ -31,8 +31,8 @@ class base::os::centos {
# CentOS repo rpm gpg key # CentOS repo rpm gpg key
base::rpm::import { 'centos-rpmkey': base::rpm::import { 'centos-rpmkey':
url => "/etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-${::lsbmajdistrelease}", url => "/etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-${lsbmajdistrelease}",
signature => $::lsbmajdistrelease ? { signature => $lsbmajdistrelease ? {
'5' => 'gpg-pubkey-e8562897-459f07a4', '5' => 'gpg-pubkey-e8562897-459f07a4',
'6' => 'gpg-pubkey-c105b9de-4e0fd3a3', '6' => 'gpg-pubkey-c105b9de-4e0fd3a3',
'7' => 'gpg-pubkey-f4a80eb5-53a7ff4b', '7' => 'gpg-pubkey-f4a80eb5-53a7ff4b',
......
...@@ -33,7 +33,7 @@ class base::os::redhat { ...@@ -33,7 +33,7 @@ class base::os::redhat {
} }
# RHEL RPM GPG Key stuff # RHEL RPM GPG Key stuff
case $::lsbmajdistrelease { case $lsbmajdistrelease {
# RHEL4 # RHEL4
'4': { '4': {
# CentOS repo handled in centos.pp # CentOS repo handled in centos.pp
...@@ -56,13 +56,13 @@ class base::os::redhat { ...@@ -56,13 +56,13 @@ class base::os::redhat {
if ($::operatingsystem == 'RedHat') { if ($::operatingsystem == 'RedHat') {
base::rpm::import { 'redhat-rpmkey': base::rpm::import { 'redhat-rpmkey':
url => '/etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release', url => '/etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release',
signature => $::lsbmajdistrelease ? { signature => $lsbmajdistrelease ? {
'5' => 'gpg-pubkey-37017186-45761324', '5' => 'gpg-pubkey-37017186-45761324',
'6' => 'gpg-pubkey-fd431d51-4ae0493b', '6' => 'gpg-pubkey-fd431d51-4ae0493b',
}; };
} }
} }
if ($::lsbmajdistrelease != '7') { if ($lsbmajdistrelease != '7') {
base::rpm::import { 'dag-rpmkey': base::rpm::import { 'dag-rpmkey':
url => url =>
'/usr/share/doc/rpmforge-release-0.3.6/RPM-GPG-KEY-rpmforge-dag', '/usr/share/doc/rpmforge-release-0.3.6/RPM-GPG-KEY-rpmforge-dag',
...@@ -76,12 +76,12 @@ class base::os::redhat { ...@@ -76,12 +76,12 @@ class base::os::redhat {
} }
# EL7 has its own class # EL7 has its own class
if ($::lsbmajdistrelease == '7') { if ($lsbmajdistrelease == '7') {
include base::os::redhat::el7 include base::os::redhat::el7
} }
# RHEL4 and 5 need links to krb utils # RHEL4 and 5 need links to krb utils
case $::lsbmajdistrelease { case $lsbmajdistrelease {
'4','5': { '4','5': {
file { file {
'/usr/bin/kinit': '/usr/bin/kinit':
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
# - Disable firewalld in favor of iptables # - Disable firewalld in favor of iptables
class base::os::redhat::el7 { class base::os::redhat::el7 {
if ($::lsbmajdistrelease == '7') { if ($lsbmajdistrelease == '7') {
# dependencies to run the stanford-* tools # dependencies to run the stanford-* tools
$el7_deps = [ 'perl-Config-Simple', 'perl-Crypt-PasswdMD5', $el7_deps = [ 'perl-Config-Simple', 'perl-Crypt-PasswdMD5',
...@@ -23,7 +23,7 @@ class base::os::redhat::el7 { ...@@ -23,7 +23,7 @@ class base::os::redhat::el7 {
# remove versions of AFS cell configs installed by openafs-* # remove versions of AFS cell configs installed by openafs-*
# Due to an encoding 'bug' in Puppet, Puppet cannot checksum the AFS # Due to an encoding 'bug' in Puppet, Puppet cannot checksum the AFS
# cell configs provided by openafs* because Puppet encodes via ASCII # cell configs provided by openafs* because Puppet encodes via ASCII
# and chokes on a unicode character in the provided file # and chokes on a unicode character in the provided file
exec { 'workaround_bytelock_afs_error': exec { 'workaround_bytelock_afs_error':
path => "/usr/bin:/usr/sbin:/bin:/sbin", path => "/usr/bin:/usr/sbin:/bin:/sbin",
...@@ -86,5 +86,5 @@ and all contents are provided by modules/base/os/redhat/el7.pp. Removing ...@@ -86,5 +86,5 @@ and all contents are provided by modules/base/os/redhat/el7.pp. Removing
files in this directory will trigger restarts of critical system services.\n", files in this directory will trigger restarts of critical system services.\n",
} }
} }
} }
# Since some production RHEL6 hosts (e.g. zm01) have # Since some production RHEL6 hosts (e.g. zm01) have
# overrides to the syslog.conf file, that part of this # overrides to the syslog.conf file, that part of this
# class is being left commented out for now. # class is being left commented out for now.
# #
...@@ -13,19 +13,19 @@ ...@@ -13,19 +13,19 @@
class base::os::redhat::syslog inherits base::syslog { class base::os::redhat::syslog inherits base::syslog {
# assuming only affected on RHEL6 for now # assuming only affected on RHEL6 for now
if ($::lsbmajdistrelease == '6') { if ($lsbmajdistrelease == '6') {
Base::Syslog::Config::Rsyslog['/etc/rsyslog.conf'] { Base::Syslog::Config::Rsyslog['/etc/rsyslog.conf'] {
use_v5 => 'true', use_v5 => 'true',
use_syslog_conf => 'true', use_syslog_conf => 'true',
use_default => 'false', use_default => 'false',
} }
# if these files happen to be present, rsyslog will really # if these files happen to be present, rsyslog will really
# complain upon restart # complain upon restart
$rsyslog_files = [ '/etc/rsyslog.d/20-templates.conf', $rsyslog_files = [ '/etc/rsyslog.d/20-templates.conf',
'/etc/rsyslog.d/95-default.conf', '/etc/rsyslog.d/95-default.conf',
'/etc/rsyslog.d/postfix.conf' ] '/etc/rsyslog.d/postfix.conf' ]
file { $rsyslog_files: ensure => absent } file { $rsyslog_files: ensure => absent }
# uncomment to enforce a 'sane' global syslog.conf # uncomment to enforce a 'sane' global syslog.conf
#Base::Syslog::Config::Syslog['/etc/syslog.conf'] { #Base::Syslog::Config::Syslog['/etc/syslog.conf'] {
......
...@@ -11,7 +11,7 @@ class base::os::ubuntu inherits base::os::debian { ...@@ -11,7 +11,7 @@ class base::os::ubuntu inherits base::os::debian {
} }
# Triggered on Ubuntu to start the supervise process. Only on 14.10 and below. # Triggered on Ubuntu to start the supervise process. Only on 14.10 and below.
if ($::lsbmajdistrelease < 15) { if (Integer($lsbmajdistrelease) < 15) {
include base::daemontools include base::daemontools
file { file {
'/etc/init/supervise.conf': '/etc/init/supervise.conf':
......
...@@ -10,7 +10,7 @@ class base::pam::debian( ...@@ -10,7 +10,7 @@ class base::pam::debian(
package { 'libpam-afs-session': ensure => present } package { 'libpam-afs-session': ensure => present }
# Starting with Debian jessie, pam-auth-update manages the common PAM files. # Starting with Debian jessie, pam-auth-update manages the common PAM files.
if ($::lsbmajdistrelease < 8) { if (Integer($lsbmajdistrelease) < 8) {
file { file {
'/etc/pam.d/common-auth': '/etc/pam.d/common-auth':
source => 'puppet:///modules/base/pam/etc/pam.d/common-auth', source => 'puppet:///modules/base/pam/etc/pam.d/common-auth',
...@@ -30,7 +30,7 @@ class base::pam::debian( ...@@ -30,7 +30,7 @@ class base::pam::debian(
package { 'libpam-afs-session': ensure => absent } package { 'libpam-afs-session': ensure => absent }
# Starting with Debian jessie, pam-auth-update manages the common PAM files. # Starting with Debian jessie, pam-auth-update manages the common PAM files.
if ($::lsbmajdistrelease < 8) { if (Integer($lsbmajdistrelease) < 8) {
file { '/etc/pam.d/common-auth': file { '/etc/pam.d/common-auth':
ensure => absent ensure => absent
} }
......
...@@ -11,7 +11,7 @@ class base::portmap { ...@@ -11,7 +11,7 @@ class base::portmap {
'RedHat': { 'RedHat': {
include base::xinetd include base::xinetd
case $::lsbmajdistrelease { case $lsbmajdistrelease {
'6','7': { '6','7': {
package { 'rpcbind': ensure => present } package { 'rpcbind': ensure => present }
service { 'rpcbind': ensure => running } service { 'rpcbind': ensure => running }
...@@ -37,7 +37,7 @@ class base::portmap { ...@@ -37,7 +37,7 @@ class base::portmap {
# Ubuntu 11.10 switched to "rpcbind" like EL6 # Ubuntu 11.10 switched to "rpcbind" like EL6
package { 'rpcbind': ensure => present } package { 'rpcbind': ensure => present }
service { 'portmap': ensure => running } service { 'portmap': ensure => running }
} else { } else {
case $::lsbdistcodename { case $::lsbdistcodename {
'squeeze': { 'squeeze': {
package { 'portmap': ensure => present } package { 'portmap': ensure => present }
......
...@@ -18,12 +18,12 @@ class base::rpm::openafs { ...@@ -18,12 +18,12 @@ class base::rpm::openafs {
'4' => '1.6.2', '4' => '1.6.2',
default => '1.6.5', default => '1.6.5',
} }
base::rpm::yumrepo { "openafs-${openafsver}-EL${::lsbmajdistrelease}.repo": } base::rpm::yumrepo { "openafs-${openafsver}-EL${lsbmajdistrelease}.repo": }
} }
# rpm class. applied to every RHEL system via basenode (os module) # rpm class. applied to every RHEL system via basenode (os module)
class base::rpm { class base::rpm {
case $::osfamily { case $::osfamily {
'RedHat': { 'RedHat': {
include base::rpm::openafs include base::rpm::openafs
...@@ -38,9 +38,9 @@ class base::rpm { ...@@ -38,9 +38,9 @@ class base::rpm {
} }
# Apply to all RHEL releases # Apply to all RHEL releases
base::rpm::yumrepo { "dag-EL${::lsbmajdistrelease}.repo": } base::rpm::yumrepo { "dag-EL${lsbmajdistrelease}.repo": }
base::rpm::yumrepo { "stanford-priv-EL${::lsbmajdistrelease}.repo": } base::rpm::yumrepo { "stanford-priv-EL${lsbmajdistrelease}.repo": }
base::rpm::yumrepo { "stanford-EL${::lsbmajdistrelease}.repo": } base::rpm::yumrepo { "stanford-EL${lsbmajdistrelease}.repo": }
# puppetlabs repo now being mirrored on yum.stanford.edu # puppetlabs repo now being mirrored on yum.stanford.edu
file { '/etc/yum.repos.d/puppet-mirror.repo': file { '/etc/yum.repos.d/puppet-mirror.repo':
ensure => present, ensure => present,
...@@ -58,7 +58,7 @@ class base::rpm { ...@@ -58,7 +58,7 @@ class base::rpm {
require => Package['newsyslog']; require => Package['newsyslog'];
} }
case $::lsbmajdistrelease { case $lsbmajdistrelease {
# RHEL4 # RHEL4
'4': { '4': {
include base::up2date include base::up2date
...@@ -68,9 +68,9 @@ class base::rpm { ...@@ -68,9 +68,9 @@ class base::rpm {
} }
# RHEL5+ # RHEL5+
default: { default: {
# EL6/7 includes this plugin by default # EL6/7 includes this plugin by default
if ($::lsbmajdistrelease == '5') { if ($lsbmajdistrelease == '5') {
package { 'yum-downloadonly': package { 'yum-downloadonly':
ensure => installed, ensure => installed,
} }
} }
...@@ -99,7 +99,7 @@ class base::rpm { ...@@ -99,7 +99,7 @@ class base::rpm {
} }
# only RHEL4 and RHEL5 use rpmpkgs log # only RHEL4 and RHEL5 use rpmpkgs log
if ($::lsbmajdistrelease == '4' or $::lsbmajdistrelease == '5') { if ($lsbmajdistrelease == '4' or $lsbmajdistrelease == '5') {
# rotate /var/log/rpmpkgs weekly # rotate /var/log/rpmpkgs weekly
file { '/etc/newsyslog.weekly/rpmpkgs': file { '/etc/newsyslog.weekly/rpmpkgs':
source => 'puppet:///modules/base/rpm/etc/newsyslog.weekly/rpmpkgs', source => 'puppet:///modules/base/rpm/etc/newsyslog.weekly/rpmpkgs',
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# authentication.) # authentication.)
class base::ssh::hostbased inherits base::ssh::pubkey { class base::ssh::hostbased inherits base::ssh::pubkey {
if ($::osfamily == 'RedHat') and ($::lsbmajdistrelease >= 6) { if ($::osfamily == 'RedHat') and (Integer($lsbmajdistrelease) >= 6) {
fail("ssh::new::hostbased should not be used with RHEL 6 or later") fail("ssh::new::hostbased should not be used with RHEL 6 or later")
} }
......
...@@ -12,10 +12,10 @@ class base::ssh::package ( ...@@ -12,10 +12,10 @@ class base::ssh::package (
$sshd_package = 'openssh-server' $sshd_package = 'openssh-server'
# Debian wheezy is the oldest supported version # Debian wheezy is the oldest supported version
if ($::lsbmajdistrelease < 7) { if (Integer($lsbmajdistrelease) < 7) {
fail('pam_duo requires at least Debian wheezy') fail('pam_duo requires at least Debian wheezy')
} }
elsif ($::lsbmajdistrelease == 7) { elsif (Integer($lsbmajdistrelease) == 7) {
# On wheezy, pin the backported openssh # On wheezy, pin the backported openssh
file { '/etc/apt/preferences.d/openssh': file { '/etc/apt/preferences.d/openssh':
ensure => present, ensure => present,
...@@ -28,7 +28,7 @@ class base::ssh::package ( ...@@ -28,7 +28,7 @@ class base::ssh::package (
$sshd_package = 'openssh-server' $sshd_package = 'openssh-server'
# Ubuntu trusty is the oldest supported version # Ubuntu trusty is the oldest supported version
if ($::lsbmajdistrelease < 14) { if (Integer($lsbmajdistrelease) < 14) {
fail('pam_duo requires at least Ubuntu trusty') fail('pam_duo requires at least Ubuntu trusty')
} }
} }
...@@ -39,7 +39,7 @@ class base::ssh::package ( ...@@ -39,7 +39,7 @@ class base::ssh::package (
$sshd_package = 'openssh-server' $sshd_package = 'openssh-server'
# RHEL/CentOS 7 is the oldest supported version # RHEL/CentOS 7 is the oldest supported version
if ($::lsbmajdistrelease < 7) { if (Integer($lsbmajdistrelease) < 7) {
fail('pam_duo requires at least RHEL/CentOS 7') fail('pam_duo requires at least RHEL/CentOS 7')
} }
} }
......
...@@ -44,7 +44,7 @@ class base::syslog( ...@@ -44,7 +44,7 @@ class base::syslog(
} }
# RHEL4/5 are ancient and use syslog, everything modern uses rsyslog # RHEL4/5 are ancient and use syslog, everything modern uses rsyslog
if ( $::osfamily == 'RedHat' and $::lsbmajdistrelease < 6 ) { if ( $::osfamily == 'RedHat' and Integer($lsbmajdistrelease) < 6 ) {
service { 'syslog': ensure => running } service { 'syslog': ensure => running }
} else { } else {
file { '/etc/rsyslog.d': file { '/etc/rsyslog.d':
......
...@@ -46,8 +46,8 @@ class base::vmguest( ...@@ -46,8 +46,8 @@ class base::vmguest(
# we do not the rebundled version by this name # we do not the rebundled version by this name
package { 'VMwareTools': ensure => absent } package { 'VMwareTools': ensure => absent }
# VMWare recommends open-vm-tools for EL7 # VMWare recommends open-vm-tools for EL7
if ($::lsbmajdistrelease != '7') { if ($lsbmajdistrelease != '7') {
base::rpm::yumrepo { "vmware-tools-EL${::lsbmajdistrelease}.repo": } base::rpm::yumrepo { "vmware-tools-EL${lsbmajdistrelease}.repo": }
base::rpm::import { base::rpm::import {
'vmware-tools-dsa': 'vmware-tools-dsa':
url => url =>
...@@ -61,7 +61,7 @@ class base::vmguest( ...@@ -61,7 +61,7 @@ class base::vmguest(
package { 'vmware-tools-esx-nox': package { 'vmware-tools-esx-nox':
ensure => present, ensure => present,
require => [ require => [
Base::Rpm::Yumrepo["vmware-tools-EL${::lsbmajdistrelease}.repo"], Base::Rpm::Yumrepo["vmware-tools-EL${lsbmajdistrelease}.repo"],
Base::Rpm::Import['vmware-tools-dsa'], Base::Rpm::Import['vmware-tools-dsa'],
Base::Rpm::Import['vmware-tools-rsa'], Base::Rpm::Import['vmware-tools-rsa'],
Package['VMwareTools'] Package['VMwareTools']
......
...@@ -12,7 +12,7 @@ define base::xinetd::service( ...@@ -12,7 +12,7 @@ define base::xinetd::service(
# Used for the file suffix. # Used for the file suffix.
case $::osfamily { case $::osfamily {
Debian: { $os = $::osfamily } Debian: { $os = $::osfamily }
RedHat: { $os = "${::operatingsystem}${::lsbmajdistrelease}" } RedHat: { $os = "${::operatingsystem}${lsbmajdistrelease}" }
} }
case $ensure { case $ensure {
......
...@@ -7,11 +7,11 @@ class base::yumtools::yum_puppet_lock ( ...@@ -7,11 +7,11 @@ class base::yumtools::yum_puppet_lock (
$puppet_version = '3.7.2-1' $puppet_version = '3.7.2-1'
) { ) {
base::yumtools::versionlock { base::yumtools::versionlock {
"0:puppet-${puppet_version}.el${::lsbmajdistrelease}*": "0:puppet-${puppet_version}.el${lsbmajdistrelease}*":
ensure => present, ensure => present,
} }
base::yumtools::versionlock { base::yumtools::versionlock {
"1:facter-${facter_version}.el${::lsbmajdistrelease}*": "1:facter-${facter_version}.el${lsbmajdistrelease}*":
ensure => present, ensure => present,
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment