From c7fbee0df7963102c41e063f7203db1fb9b3f1eb Mon Sep 17 00:00:00 2001 From: William Bradford Clark Date: Wed, 20 Apr 2022 06:59:28 -0400 Subject: [PATCH] Pre-install foreman-selinux in acceptance environment Also do not purge foreman-selinux between tests. This is a workaround for the Puppet issue [PUP-10548]. --- spec/setup_acceptance_node.pp | 13 ++++++++++--- spec/support/acceptance/purge.rb | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/spec/setup_acceptance_node.pp b/spec/setup_acceptance_node.pp index 9eda8336e..c8ea481d8 100644 --- a/spec/setup_acceptance_node.pp +++ b/spec/setup_acceptance_node.pp @@ -3,11 +3,18 @@ } # Needed for idempotency when SELinux is enabled -if $foreman::repo::configure_scl_repo { - package { 'rh-redis5-redis': - ensure => installed, +if $facts['os']['selinux']['enabled'] { + package { 'foreman-selinux': + ensure => latest, require => Class['foreman::repo'], } + + if $foreman::repo::configure_scl_repo { + package { 'rh-redis5-redis': + ensure => installed, + require => Class['foreman::repo'], + } + } } # Not /etc/foreman because purging removes that diff --git a/spec/support/acceptance/purge.rb b/spec/support/acceptance/purge.rb index 601a0c56c..fa5dc3738 100644 --- a/spec/support/acceptance/purge.rb +++ b/spec/support/acceptance/purge.rb @@ -1,7 +1,7 @@ def purge_foreman case fact('osfamily') when 'RedHat' - on default, 'yum -y remove foreman* tfm-*' + on default, 'rpm -qa | grep -P \'^tfm|^foreman(?!-selinux)\' | xargs yum -y remove' when 'Debian' on default, 'apt-get purge -y foreman*', { :acceptable_exit_codes => [0, 100] } on default, 'apt-get purge -y ruby-hammer-cli-*', { :acceptable_exit_codes => [0, 100] }