Skip to content

Commit

Permalink
Drop EL7 compatibility code
Browse files Browse the repository at this point in the history
Previously EL7 was dropped from metadata.json, but this really removes
all the relevant code to support it.

Fixes: a830f64 ("remove legacy os'es")
  • Loading branch information
ekohl committed Mar 26, 2024
1 parent 4641887 commit a8c7827
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 158 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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).

Expand Down
19 changes: 0 additions & 19 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

* [`redis`](#redis): This class installs redis
* [`redis::administration`](#redis--administration): Allows various administrative settings for Redis
* [`redis::globals`](#redis--globals): Set a global config for Redis
* [`redis::sentinel`](#redis--sentinel): Install redis-sentinel

#### Private Classes
Expand Down Expand Up @@ -1489,24 +1488,6 @@ Set somaxconn value

Default value: `65535`

### <a name="redis--globals"></a>`redis::globals`

Set a global config for Redis

#### Parameters

The following parameters are available in the `redis::globals` class:

* [`scl`](#-redis--globals--scl)

##### <a name="-redis--globals--scl"></a>`scl`

Data type: `Optional[String]`

Use a specific Software Collection on Red Hat 7 based systems

Default value: `undef`

### <a name="redis--sentinel"></a>`redis::sentinel`

Install redis-sentinel
Expand Down
11 changes: 0 additions & 11 deletions manifests/globals.pp

This file was deleted.

68 changes: 24 additions & 44 deletions manifests/params.pp
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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': {
Expand Down
11 changes: 1 addition & 10 deletions manifests/preinstall.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
34 changes: 0 additions & 34 deletions spec/acceptance/suites/scl/redis5_spec.rb

This file was deleted.

37 changes: 0 additions & 37 deletions spec/classes/redis_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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') }

Expand Down
1 change: 0 additions & 1 deletion spec/spec_helper_acceptance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a8c7827

Please sign in to comment.