Added conditional install statements for kernel header packages

Consumed puppet modules may declare these (example: openafs).
This patch wraps the kernel header modules in test conditionals to
avoid conflicts.

Change-Id: I72962ae0d006cfe5f5d7e61046fd4862067b3b44
This commit is contained in:
Michael Krotscheck 2016-01-27 11:27:24 -08:00
parent 730c88eb8a
commit 9e01a13ce1

View File

@ -93,23 +93,51 @@ class openstack_project::slave_common(
# install linux-headers depending on OS version
case $::osfamily {
'RedHat': {
$header_packages = ['kernel-devel', 'kernel-headers']
if ! defined(Package['kernel-devel']) {
package { 'kernel-devel':
ensure => present,
}
}
if ! defined(Package['kernel-headers']) {
package { 'kernel-headers':
ensure => present,
}
}
}
'Debian': {
if ($::operatingsystem == 'Debian') {
# install depending on kernel release
$header_packages = [ "linux-headers-${::kernelrelease}", ]
if ! defined(Package["linux-headers-${::kernelrelease}"]) {
package { "linux-headers-${::kernelrelease}":
ensure => present,
}
}
}
else {
if ($::lsbdistcodename == 'precise') {
$header_packages = ['linux-headers-virtual', 'linux-headers-generic']
if ! defined(Package['linux-headers-virtual']) {
package { 'linux-headers-virtual':
ensure => present,
}
}
if ! defined(Package['linux-headers-generic']) {
package { 'linux-headers-generic':
ensure => present,
}
}
}
else {
# In trusty (and later), linux-headers-virtual is a transitional package that
# simply depends on linux-headers-generic, so there is no need to specify it
# any more. Specifying it when installing on an arm64 host causes an error,
# as linux-headers-virtual does not exist for arm64/aarch64.
$header_packages = ['linux-headers-generic']
if ! defined(Package['linux-headers-generic']) {
package { 'linux-headers-generic':
ensure => present,
}
}
}
}
}
@ -118,10 +146,6 @@ class openstack_project::slave_common(
}
}
package { $header_packages:
ensure => present
}
file { '/etc/zuul-env-reqs.txt':
ensure => present,
owner => 'root',