From c70d8c8baa993d9c7b133a526257973619feb1fb Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Tue, 26 Mar 2024 14:20:48 +0100 Subject: [PATCH] Drop EL7 compatibility code Previously EL7 was dropped from metadata.json, but this really removes all the relevant code to support it. Fixes: a830f645a02a ("remove legacy os'es") --- README.md | 4 +- manifests/globals.pp | 11 ---- manifests/params.pp | 68 ++++++++--------------- manifests/preinstall.pp | 11 +--- spec/acceptance/suites/scl/redis5_spec.rb | 34 ------------ spec/classes/redis_spec.rb | 37 ------------ spec/spec_helper_acceptance.rb | 1 - 7 files changed, 27 insertions(+), 139 deletions(-) delete mode 100644 manifests/globals.pp delete mode 100644 spec/acceptance/suites/scl/redis5_spec.rb diff --git a/README.md b/README.md index 8a551082..32e6fa48 100644 --- a/README.md +++ b/README.md @@ -111,7 +111,7 @@ class { 'redis': } ``` -**Warning** note that PPA usage requires [puppetlabs/apt](https://forge.puppet.com/puppetlabs/apt) on Ubuntu distros. On EL7 [puppet/epel](https://forge.puppet.com/puppet/epel) is needed unless the installation is using Software Collections. In that case will install `centos-release-scl-rh` from CentOS extras. For RHEL or other RHEL-derivatives this isn't managed. +**Warning** note that PPA usage requires [puppetlabs/apt](https://forge.puppet.com/puppetlabs/apt) on Ubuntu distros ### Redis Sentinel @@ -135,7 +135,7 @@ class { 'redis::sentinel': ### Soft dependency -When managing the repo, it either needs [puppetlabs/apt](https://forge.puppet.com/puppetlabs/apt) or [puppet/epel](https://forge.puppet.com/puppet/epel). +When managing the repo, it needs [puppetlabs/apt](https://forge.puppet.com/puppetlabs/apt). For administration of sysctl it depends on [herculesteam/augeasproviders_sysctl](https://forge.puppet.com/herculesteam/augeasproviders_sysctl). diff --git a/manifests/globals.pp b/manifests/globals.pp deleted file mode 100644 index bccaee3a..00000000 --- a/manifests/globals.pp +++ /dev/null @@ -1,11 +0,0 @@ -# @summary Set a global config for Redis -# -# @param scl -# Use a specific Software Collection on Red Hat 7 based systems -class redis::globals ( - Optional[String] $scl = undef, -) { - if $scl and $facts['os']['family'] != 'RedHat' { - fail('SCLs are only supported on the Red Hat OS family') - } -} diff --git a/manifests/params.pp b/manifests/params.pp index a9d278d1..acdd0bbe 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -1,6 +1,6 @@ # @summary This class provides a number of parameters. # @api private -class redis::params inherits redis::globals { +class redis::params { case $facts['os']['family'] { 'Debian': { $config_dir = '/etc/redis' @@ -47,51 +47,31 @@ $sentinel_daemonize = false $sentinel_working_dir = '/tmp' - $scl = $redis::globals::scl - if $scl { - $config_dir = "/etc/opt/rh/${scl}" - $config_file = "/etc/opt/rh/${scl}/redis.conf" - $config_file_orig = "/etc/opt/rh/${scl}/redis.conf.puppet" - $log_dir = "/var/opt/rh/${scl}/log/redis" - $package_name = "${scl}-redis" - $pid_file = "/var/opt/rh/${scl}/run/redis_6379.pid" - $service_name = "${scl}-redis" - $workdir = "/var/opt/rh/${scl}/lib/redis" - $bin_path = "/opt/rh/${scl}/root/usr/bin" - - $sentinel_config_file = "${config_dir}/redis-sentinel.conf" - $sentinel_config_file_orig = "${config_dir}/redis-sentinel.conf.puppet" - $sentinel_service_name = "${scl}-redis-sentinel" - $sentinel_package_name = $package_name - $sentinel_pid_file = "/var/opt/rh/${scl}/run/redis-sentinel.pid" - $sentinel_log_file = "/var/opt/rh/${scl}/log/redis/sentinel.log" + $config_dir = '/etc/redis' + if (versioncmp($facts['os']['release']['major'], '9') >= 0) { + $config_file = '/etc/redis/redis.conf' + $config_file_orig = '/etc/redis/redis.conf.puppet' } else { - $config_dir = '/etc/redis' - if (versioncmp($facts['os']['release']['major'], '9') >= 0) { - $config_file = '/etc/redis/redis.conf' - $config_file_orig = '/etc/redis/redis.conf.puppet' - } else { - $config_file = '/etc/redis.conf' - $config_file_orig = '/etc/redis.conf.puppet' - } - $log_dir = '/var/log/redis' - $package_name = 'redis' - $pid_file = '/var/run/redis_6379.pid' - $service_name = 'redis' - $workdir = '/var/lib/redis' - $bin_path = '/usr/bin' - if (versioncmp($facts['os']['release']['major'], '9') >= 0) { - $sentinel_config_file = '/etc/redis/sentinel.conf' - $sentinel_config_file_orig = '/etc/redis/sentinel.conf.puppet' - } else { - $sentinel_config_file = '/etc/redis-sentinel.conf' - $sentinel_config_file_orig = '/etc/redis-sentinel.conf.puppet' - } - $sentinel_service_name = 'redis-sentinel' - $sentinel_package_name = 'redis' - $sentinel_pid_file = '/var/run/redis/redis-sentinel.pid' - $sentinel_log_file = '/var/log/redis/sentinel.log' + $config_file = '/etc/redis.conf' + $config_file_orig = '/etc/redis.conf.puppet' + } + $log_dir = '/var/log/redis' + $package_name = 'redis' + $pid_file = '/var/run/redis_6379.pid' + $service_name = 'redis' + $workdir = '/var/lib/redis' + $bin_path = '/usr/bin' + if (versioncmp($facts['os']['release']['major'], '9') >= 0) { + $sentinel_config_file = '/etc/redis/sentinel.conf' + $sentinel_config_file_orig = '/etc/redis/sentinel.conf.puppet' + } else { + $sentinel_config_file = '/etc/redis-sentinel.conf' + $sentinel_config_file_orig = '/etc/redis-sentinel.conf.puppet' } + $sentinel_service_name = 'redis-sentinel' + $sentinel_package_name = 'redis' + $sentinel_pid_file = '/var/run/redis/redis-sentinel.pid' + $sentinel_log_file = '/var/log/redis/sentinel.log' } 'FreeBSD': { diff --git a/manifests/preinstall.pp b/manifests/preinstall.pp index 112ea705..6b2c4756 100644 --- a/manifests/preinstall.pp +++ b/manifests/preinstall.pp @@ -3,16 +3,7 @@ # @api private class redis::preinstall { if $redis::manage_repo { - if $facts['os']['family'] == 'RedHat' and versioncmp($facts['os']['release']['major'], '7') <= 0 { - if $redis::scl { - if $facts['os']['name'] == 'CentOS' { - ensure_packages(['centos-release-scl-rh']) - Package['centos-release-scl-rh'] -> Package[$redis::package_name] - } - } else { - require 'epel' - } - } elsif $facts['os']['name'] == 'Ubuntu' and $redis::ppa_repo { + if $facts['os']['name'] == 'Ubuntu' and $redis::ppa_repo { contain 'apt' apt::ppa { $redis::ppa_repo: } } elsif $facts['os']['family'] == 'Debian' and $redis::redis_apt_repo { diff --git a/spec/acceptance/suites/scl/redis5_spec.rb b/spec/acceptance/suites/scl/redis5_spec.rb deleted file mode 100644 index 7379a382..00000000 --- a/spec/acceptance/suites/scl/redis5_spec.rb +++ /dev/null @@ -1,34 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper_acceptance' - -describe 'redis', if: %w[centos redhat].include?(os[:family]) && os[:release].to_i == 7 do - before(:all) do - apply_manifest_on(hosts, 'service{"redis" : ensure => stopped, enable => false}') - end - - after(:all) do - apply_manifest('service{"rh-redis5-redis" : ensure => stopped, enable => false}') - end - - include_examples 'an idempotent resource' do - let(:manifest) do - <<-PUPPET - class { 'redis::globals': - scl => 'rh-redis5', - } - class { 'redis': - manage_repo => true, - } - PUPPET - end - end - - specify { expect(package('rh-redis5-redis')).to be_installed } - specify { expect(service('rh-redis5-redis')).to be_running.and be_enabled } - - it 'redis should respond to ping command' do - expect(command('scl enable rh-redis5 -- redis-cli ping')). - to have_attributes(stdout: %r{PONG}) - end -end diff --git a/spec/classes/redis_spec.rb b/spec/classes/redis_spec.rb index 4cc989d4..05ab11d7 100644 --- a/spec/classes/redis_spec.rb +++ b/spec/classes/redis_spec.rb @@ -51,37 +51,6 @@ it { is_expected.to contain_service(service_name).with_ensure('running').with_enable('true') } - context 'with SCL', if: facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'].to_i < 8 do - let(:pre_condition) do - <<-PUPPET - class { 'redis::globals': - scl => 'rh-redis5', - } - PUPPET - end - - it { is_expected.to compile.with_all_deps } - - it do - is_expected.to create_class('redis'). - with_package_name('rh-redis5-redis'). - with_config_file('/etc/opt/rh/rh-redis5/redis.conf'). - with_service_name('rh-redis5-redis') - end - - context 'manage_repo => true' do - let(:params) { { manage_repo: true } } - - it { is_expected.to compile.with_all_deps } - - if facts[:os]['name'] == 'CentOS' - it { is_expected.to contain_package('centos-release-scl-rh') } - else - it { is_expected.not_to contain_package('centos-release-scl-rh') } - end - end - end - describe 'with manage_dnf_module true', if: facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'].to_i == 8 do let(:pre_condition) do <<-PUPPET @@ -501,12 +470,6 @@ class { 'redis': describe 'with parameter: manage_repo' do let(:params) { { manage_repo: true } } - if facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'].to_i <= 7 - it { is_expected.to contain_class('epel') } - else - it { is_expected.not_to contain_class('epel') } - end - describe 'with ppa' do let(:params) { super().merge(ppa_repo: 'ppa:rwky/redis') } diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index abad3fa0..ba35a2f6 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -5,7 +5,6 @@ configure_beaker do |host| # sysctl is untestable in docker install_puppet_module_via_pmt_on(host, 'puppet-augeasproviders_sysctl') unless host['hypervisor'] == 'docker' - install_puppet_module_via_pmt_on(host, 'puppet-epel') if fact_on(host, 'os.family') == 'RedHat' && fact_on(host, 'os.release.major').to_i == 7 unless fact_on(host, 'os.family') == 'RedHat' && fact_on(host, 'os.release.major').to_i >= 9 # puppet-bolt rpm for CentOS 9 is not yet available