Merge branch 'bugfix/reboot-required-jessie' into 'master'

Bugfix/reboot required jessie

I've mistakenly marked !40 as merged :/

See merge request !46
This commit is contained in:
Jerome Charaoui 2016-06-29 19:47:42 +00:00
commit 1a87e2f7d4
3 changed files with 57 additions and 16 deletions

View file

@ -1,21 +1,11 @@
class apt::reboot_required_notify {
# This package installs the script that created /var/run/reboot-required*.
# This script (/usr/share/update-notifier/notify-reboot-required) is
# triggered e.g. by kernel packages.
package { 'update-notifier-common':
ensure => installed,
}
# cron-apt defaults to run every night at 4 o'clock
# plus some random time <1h.
# so we check if a reboot is required a bit later.
cron { 'apt_reboot_required_notify':
command => 'if [ -f /var/run/reboot-required ]; then echo "Reboot required\n" ; cat /var/run/reboot-required.pkgs ; fi',
user => root,
hour => 5,
minute => 20,
require => Package['update-notifier-common'],
if versioncmp($::operatingsystemmajrelease, 8) >= 0 {
class { 'apt::reboot_required_notify::jessie': }
# Clean up systems that were upgraded from Wheezy or earlier:
class { 'apt::reboot_required_notify::wheezy': ensure => absent }
} else {
class { 'apt::reboot_required_notify::wheezy': }
}
}

View file

@ -0,0 +1,28 @@
class apt::reboot_required_notify::jessie ($ensure = present) {
if $::operatingsystemmajrelease == 8 and ! $::apt::use_backports {
fail('apt::reboot_required_notify requires $apt::use_backports on Jessie')
}
$pinning_ensure = $::operatingsystemmajrelease ? {
8 => present,
default => absent,
}
apt::preferences_snippet { 'reboot-notifier':
ensure => $pinning_ensure,
pin => 'release o=Debian Backports,a=jessie-backports',
priority => 991,
}
# On Jessie and newer, this package installs the script that created
# /var/run/reboot-required*.
# This script (/usr/share/update-notifier/notify-reboot-required) is
# triggered e.g. by kernel packages.
# This package also sends a daily email to the administrator when a system
# reboot is required, e.g. due to a kernel update.
package { 'reboot-notifier':
ensure => $ensure,
require => Apt::Preferences_snippet['reboot-notifier'],
}
}

View file

@ -0,0 +1,23 @@
class apt::reboot_required_notify::wheezy ($ensure = present) {
# On Wheezy and older, this package installs the script that created
# /var/run/reboot-required*.
# This script (/usr/share/update-notifier/notify-reboot-required) is
# triggered e.g. by kernel packages.
package { 'update-notifier-common':
ensure => $ensure,
}
# cron-apt defaults to run every night at 4 o'clock
# plus some random time <1h.
# so we check if a reboot is required a bit later.
cron { 'apt_reboot_required_notify':
ensure => $ensure,
command => 'if [ -f /var/run/reboot-required ]; then echo "Reboot required\n" ; cat /var/run/reboot-required.pkgs ; fi',
user => root,
hour => 5,
minute => 20,
require => Package['update-notifier-common'],
}
}