From 9e01a13ce17718d561dd6accba1cf28073f0eb4a Mon Sep 17 00:00:00 2001 From: Michael Krotscheck Date: Wed, 27 Jan 2016 11:27:24 -0800 Subject: [PATCH] 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 --- .../manifests/slave_common.pp | 42 +++++++++++++++---- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/modules/openstack_project/manifests/slave_common.pp b/modules/openstack_project/manifests/slave_common.pp index 70c5617e09..a4d7612ce4 100644 --- a/modules/openstack_project/manifests/slave_common.pp +++ b/modules/openstack_project/manifests/slave_common.pp @@ -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}", ] + # install depending on kernel release + 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',