Attempt to fix version comparisons
authorJulien Cristau <jcristau@debian.org>
Sat, 18 Mar 2017 22:16:30 +0000 (23:16 +0100)
committerJulien Cristau <jcristau@debian.org>
Sat, 18 Mar 2017 22:16:30 +0000 (23:16 +0100)
Use versioncmp function instead of string comparison.  Thanks olasd.

15 files changed:
modules/acpi/manifests/init.pp
modules/apache2/manifests/init.pp
modules/apache2/manifests/site.pp
modules/apache2/templates/default-debian.org.erb
modules/apache2/templates/puppet-config.erb
modules/bacula/manifests/client.pp
modules/debian_org/manifests/apt.pp
modules/debian_org/manifests/init.pp
modules/debian_org/templates/dsa-puppet-stuff.cron.erb
modules/ferm/manifests/init.pp
modules/ferm/templates/ferm.conf.erb
modules/monit/manifests/init.pp
modules/nagios/templates/obsolete-packages-ignore.d-hostspecific.erb
modules/samhain/templates/samhainrc.erb
modules/ssh/manifests/init.pp

index f2c621b..2a4fc15 100644 (file)
@@ -1,6 +1,6 @@
 class acpi {
        if ! ($::debarchitecture in ['kfreebsd-amd64', 'kfreebsd-i386']) {
-               if ($::lsbmajdistrelease >= '8') {
+               if (versioncmp($::lsbmajdistrelease, '8') >= 0) {
                        package { 'acpid':
                                ensure => purged
                        }
index 19400ad..b0bde41 100644 (file)
@@ -105,7 +105,7 @@ class apache2 {
                apache2::module { 'mpm_prefork': ensure => absent }
                apache2::module { 'mpm_worker': }
        }
-       if $::lsbmajdistrelease > '7' {
+       if versioncmp($::lsbmajdistrelease, '7') > 0 {
                file { '/etc/apache2/mods-available/mpm_worker.conf':
                        content => template('apache2/mpm_worker.erb'),
                }
index ff1ee20..6d5ec55 100644 (file)
@@ -46,7 +46,7 @@ define apache2::site (
                }
        }
 
-       if $::lsbmajdistrelease <= '7' {
+       if versioncmp($::lsbmajdistrelease, '7') <= 0 {
                $symlink = "/etc/apache2/sites-enabled/${name}"
        } else {
                $symlink = "/etc/apache2/sites-enabled/${name}.conf"
index dff8a4f..0c9eff3 100644 (file)
@@ -10,7 +10,7 @@
        CustomLog /var/log/apache2/access.log privacy
 
        DocumentRoot /srv/www/default.debian.org/htdocs
-       <% if @lsbmajdistrelease > '7' -%>
+       <% if scope.call_function('versioncmp', [@lsbmajdistrelease, '7']) > 0 -%>
        <Directory /srv/www/default.debian.org/htdocs>
                Require all granted
        </Directory>
index 7edde69..7c38884 100644 (file)
@@ -4,7 +4,7 @@
 
   # this is a list that seems suitable as of 2014-10, when running wheezy.  It
   # probably requires re-visiting regularly.
-  <% if @lsbmajdistrelease <= '7' -%>
+  <% if scope.call_function('versioncmp', [@lsbmajdistrelease, '7']) <= 0 -%>
     SSLCipherSuite ECDH+AESGCM:ECDH+AES256:ECDH+AES128:ECDH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!eNULL:!LOW:!MD5:!EXP:!RC4:!SEED:!DSS
   <% else -%>
     SSLCipherSuite ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!eNULL:!LOW:!MD5:!EXP:!RC4:!SEED:!DSS
index 05234fc..2918a79 100644 (file)
@@ -50,7 +50,7 @@ class bacula::client inherits bacula {
                require => Package['bacula-fd'],
                notify  => Service['bacula-fd'],
        }
-       if ($::lsbmajdistrelease >= '9' and $systemd) {
+       if (versioncmp($::lsbmajdistrelease, '9') >= 0 and $systemd) {
                file { '/etc/systemd/system/bacula-fd.service.d':
                        ensure  => directory,
                        mode    => '0755',
index 9fc02a0..948f606 100644 (file)
@@ -3,7 +3,7 @@
 # Stuff common to all debian.org servers
 #
 class debian_org::apt {
-       if $::lsbmajdistrelease <= '7' {
+       if versioncmp($::lsbmajdistrelease, '7') <= 0 {
                $mungedcodename = $::lsbdistcodename
        } elsif ($::debarchitecture in ['kfreebsd-amd64', 'kfreebsd-i386']) {
                $mungedcodename = "${::lsbdistcodename}-kfreebsd"
@@ -11,7 +11,7 @@ class debian_org::apt {
                $mungedcodename = $::lsbdistcodename
        }
 
-       if $::lsbmajdistrelease <= '8' {
+       if versioncmp($::lsbmajdistrelease, '8') <= 0 {
                $fallbackmirror = 'http://cdn-fastly.deb.debian.org/debian/'
        } else {
                $fallbackmirror = 'http://deb.debian.org/debian/'
index a8c176f..a7ff786 100644 (file)
@@ -43,7 +43,7 @@ class debian_org {
                source  => 'puppet:///modules/debian_org/basic-ssh_known_hosts'
        }
 
-       if ($::lsbmajdistrelease >= '8') {
+       if versioncmp($::lsbmajdistrelease, '8') >= 0 {
                $rubyfs_package = 'ruby-filesystem'
        } else {
                $rubyfs_package = 'libfilesystem-ruby1.9'
index 48fab72..60f2f5a 100644 (file)
@@ -5,7 +5,7 @@
 
 SHELL=/bin/bash
 @hourly  root [ ! -d /var/cache/dsa ] || touch /var/cache/dsa/cron.alive
-<% if @lsbmajdistrelease <= '7' -%>
+<% if scope.call_function('versioncmp', [@lsbmajdistrelease, '7']) <= 0 -%>
 34 */4 * * * root if [ -x /usr/sbin/puppetd ]; then sleep $(( $RANDOM \% 7200 )); if [ -x /usr/bin/timeout ]; then TO="timeout --kill-after=900 3600"; else TO=""; fi; tmp="$(tempfile)"; egrep -v '^(#|$)' /etc/dsa/cron.ignore.dsa-puppet-stuff > "$tmp" && $TO /usr/sbin/puppetd -o --no-daemonize 2>&1 | egrep --text -v -f "$tmp"; rm -f "$tmp"; fi
 <% else -%>
 34 */4 * * * root if [ -x /usr/bin/puppet ]; then sleep $(( $RANDOM \% 7200 )); if [ -x /usr/bin/timeout ]; then TO="timeout --kill-after=900 3600"; else TO=""; fi; tmp="$(tempfile)"; egrep -v '^(#|$)' /etc/dsa/cron.ignore.dsa-puppet-stuff > "$tmp" && $TO /usr/bin/puppet agent --onetime --no-daemonize 2>&1 | egrep --text -v -f "$tmp"; rm -f "$tmp"; fi
index 869a3d6..23dfc2a 100644 (file)
@@ -16,7 +16,7 @@ class ferm {
        package { 'ferm':
                ensure => installed
        }
-       if ($::lsbmajdistrelease >= '8') {
+       if (versioncmp($::lsbmajdistrelease, '8') >= 0) {
                package { 'ulogd2':
                        ensure => installed
                }
@@ -92,7 +92,7 @@ class ferm {
                content => template('ferm/interfaces.conf.erb'),
                notify  => Service['ferm'],
        }
-       if ($::lsbmajdistrelease >= '8') {
+       if (versioncmp($::lsbmajdistrelease, '8') >= 0) {
                augeas { 'logrotate_ulogd2':
                        context => '/files/etc/logrotate.d/ulogd2',
                        changes => [
index 5d63f8d..b8a6b69 100644 (file)
@@ -7,7 +7,7 @@
 
 @include 'conf.d/';
 
-<% if @lsbmajdistrelease >= '8' -%>
+<% if scope.call_function('versioncmp', [@lsbmajdistrelease, '8']) >= 0 -%>
 domain (ip ip6) {
         table filter {
               chain log_and_reject {
index 977f184..999cdfb 100644 (file)
@@ -7,7 +7,7 @@
 #   include monit
 #
 class monit {
-       if $::lsbmajdistrelease <= '7' {
+       if versioncmp($::lsbmajdistrelease, '7') <= 0 {
                package { 'monit':
                        ensure => installed
                }
index 8f81582..a1265ff 100644 (file)
@@ -14,7 +14,7 @@ when "sibelius.debian.org" then                                ignore << %w{tivs
 when /(storace|backuphost).debian.org/ then                    ignore << %w{postgresql-client-9.1}
 end
 
-if @lsbmajdistrelease <= '8'
+if scope.call_function('versioncmp', [@lsbmajdistrelease, '8']) <= 0
   case @fqdn
     when /(acker|aagaard).debian.org/ then                     ignore << %w{qemu-efi}
   end
index 018a05e..93116ac 100644 (file)
@@ -835,7 +835,7 @@ SyslogSeverity=alert
 #
 # SetDefault = no
 
-<% if @lsbmajdistrelease >= '9' -%>
+<% if scope.call_function('versioncmp', [@lsbmajdistrelease, '9']) >= 0 -%>
 [PortCheck]
 PortCheckActive=0
 <% end -%>
index fc576f8..56537e4 100644 (file)
@@ -37,7 +37,7 @@ class ssh {
                content => template('ssh/authorized_keys.erb'),
        }
 
-       if ($::lsbmajdistrelease >= '8') {
+       if (versioncmp($::lsbmajdistrelease, '8') >= 0) {
                if ! $has_etc_ssh_ssh_host_ed25519_key {
                        exec { 'create-ed25519-host-key':
                                command => 'ssh-keygen -f /etc/ssh/ssh_host_ed25519_key -q -P "" -t ed25519',