From 083e4470e4e61878f7d86926c95d4acdc3152ffb Mon Sep 17 00:00:00 2001 From: William Yardley Date: Sat, 16 Nov 2024 13:17:13 -0800 Subject: [PATCH] Add support for CentOS / RHEL 9 and drop support for 7 --- .fixtures.yml | 1 - REFERENCE.md | 15 +++------------ manifests/init.pp | 20 +++++++------------- metadata.json | 4 ++-- spec/classes/rabbitmq_spec.rb | 20 +++++++++++++++++++- spec/spec_helper_acceptance.rb | 1 - 6 files changed, 31 insertions(+), 30 deletions(-) diff --git a/.fixtures.yml b/.fixtures.yml index 7f22ca1c8..848319b8e 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -4,6 +4,5 @@ fixtures: stdlib: 'https://github.com/puppetlabs/puppetlabs-stdlib' apt: 'https://github.com/puppetlabs/puppetlabs-apt' archive: 'https://github.com/voxpupuli/puppet-archive' - epel: 'https://github.com/voxpupuli/puppet-epel' systemd: 'https://github.com/voxpupuli/puppet-systemd' yumrepo_core: 'https://github.com/puppetlabs/puppetlabs-yumrepo_core' diff --git a/REFERENCE.md b/REFERENCE.md index ccb0f54d9..9f9e414ae 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -255,7 +255,6 @@ The following parameters are available in the `rabbitmq` class: * [`port`](#-rabbitmq--port) * [`python_package`](#-rabbitmq--python_package) * [`repos_ensure`](#-rabbitmq--repos_ensure) -* [`require_epel`](#-rabbitmq--require_epel) * [`service_ensure`](#-rabbitmq--service_ensure) * [`service_manage`](#-rabbitmq--service_manage) * [`service_name`](#-rabbitmq--service_name) @@ -805,20 +804,12 @@ Default value: `'python'` Data type: `Boolean` Ensure that a repo with the official (and newer) RabbitMQ package is configured, along with its signing key. -Defaults to false (use system packages). This does not ensure that soft dependencies (like EPEL on RHEL systems) are present. -It also does not solve the erlang dependency. See https://www.rabbitmq.com/which-erlang.html for a good breakdown of the -different ways of handling the erlang deps. See also https://github.com/voxpupuli/puppet-rabbitmq/issues/788 +Defaults to false (use system packages). This does not ensure that soft dependencies are present. +It also does not solve the erlang dependency. See https://www.rabbitmq.com/which-erlang.html for a good breakdown of the +different ways of handling the erlang deps. See also https://github.com/voxpupuli/puppet-rabbitmq/issues/788 Default value: `false` -##### `require_epel` - -Data type: `Boolean` - -If this parameter is set, On CentOS / RHEL 7 systems, require the "puppet/epel" module - -Default value: `true` - ##### `service_ensure` Data type: `Enum['running', 'stopped']` diff --git a/manifests/init.pp b/manifests/init.pp index 0e9790ed2..5382d9d8e 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -242,11 +242,9 @@ # Name of the package required by rabbitmqadmin. # @param repos_ensure # Ensure that a repo with the official (and newer) RabbitMQ package is configured, along with its signing key. -# Defaults to false (use system packages). This does not ensure that soft dependencies (like EPEL on RHEL systems) are present. -# It also does not solve the erlang dependency. See https://www.rabbitmq.com/which-erlang.html for a good breakdown of the -# different ways of handling the erlang deps. See also https://github.com/voxpupuli/puppet-rabbitmq/issues/788 -# @param require_epel -# If this parameter is set, On CentOS / RHEL 7 systems, require the "puppet/epel" module +# Defaults to false (use system packages). This does not ensure that soft dependencies are present. +# It also does not solve the erlang dependency. See https://www.rabbitmq.com/which-erlang.html for a good breakdown of the +# different ways of handling the erlang deps. See also https://github.com/voxpupuli/puppet-rabbitmq/issues/788 # @param service_ensure # The state of the service. # @param service_manage @@ -461,7 +459,6 @@ Array $archive_options = [], Array $loopback_users = ['guest'], Boolean $service_restart = true, - Boolean $require_epel = true, ) { if $ssl_only and ! $ssl { fail('$ssl_only => true requires that $ssl => true') @@ -516,13 +513,10 @@ default: { } } - } elsif ($facts['os']['family'] == 'RedHat' and $facts['os']['release']['major'] == '7') and $require_epel { - # On later CentOS / RHEL systems, this is not useful since EPEL doesn't - # have the rabbitmq-server package anyway. - # - # Once support for 7 is dropped, we should remove this code and the - # parameter - require epel + } elsif $facts['os']['family'] == 'RedHat' { + package { 'centos-release-rabbitmq-38': + ensure => 'present', + } } contain rabbitmq::install diff --git a/metadata.json b/metadata.json index 807401123..507425139 100644 --- a/metadata.json +++ b/metadata.json @@ -11,13 +11,13 @@ { "operatingsystem": "RedHat", "operatingsystemrelease": [ - "7" + "9" ] }, { "operatingsystem": "CentOS", "operatingsystemrelease": [ - "7" + "9" ] }, { diff --git a/spec/classes/rabbitmq_spec.rb b/spec/classes/rabbitmq_spec.rb index 79a3108ff..6479c6cd3 100644 --- a/spec/classes/rabbitmq_spec.rb +++ b/spec/classes/rabbitmq_spec.rb @@ -38,6 +38,8 @@ it { is_expected.not_to contain_apt__source('rabbitmq') } it { is_expected.not_to contain_class('rabbitmq::repo::rhel') } it { is_expected.not_to contain_yumrepo('rabbitmq') } + + it { is_expected.to contain_package('centos-release-rabbitmq-38') } if os_facts['os']['family'] == 'RedHat' end context 'with service_restart => false' do @@ -77,6 +79,19 @@ with_baseurl(%r{https://packagecloud.io/rabbitmq/rabbitmq-server/el/\d+/\$basearch$}). with_gpgkey('https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey') end + + it { + is_expected.to contain_exec('rpm --import https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc').with( + unless: 'rpm -q gpg-pubkey-6026dfca-573adfde 2>/dev/null' + ) + } + + it { + is_expected.to contain_exec('rpm --import https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey').with( + unless: 'rpm -q gpg-pubkey-4d206f89-5bbb8d59 2>/dev/null' + ) + } + else it { is_expected.not_to contain_class('rabbitmq::repo::rhel') } it { is_expected.not_to contain_yumrepo('rabbitmq') } @@ -189,7 +204,10 @@ notify: 'Class[Rabbitmq::Service]' ) is_expected.to contain_archive('rabbitmqadmin').with_source('http://1.1.1.1:15672/cli/rabbitmqadmin') - is_expected.to contain_file('/usr/local/bin/rabbitmqadmin').with_owner('root').with_mode('0755') + is_expected.to contain_file('/usr/local/bin/rabbitmqadmin').with( + owner: 'root', + mode: '0755' + ) is_expected.to contain_exec('remove_old_rabbitmqadmin_on_upgrade').with_command("rm #{rabbitmq_home}/rabbitmqadmin") end diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 651ae67f1..a251656ec 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -7,7 +7,6 @@ when 'Debian' install_puppet_module_via_pmt_on(host, 'puppetlabs-apt', '>= 9.0.0 < 10.0.0') when 'RedHat' - install_puppet_module_via_pmt_on(host, 'puppet-epel', '>= 5.0.0 < 6.0.0') if fact_on(host, 'os.selinux.enabled') # Make sure selinux is disabled so the tests work. on host, puppet('resource', 'exec', 'setenforce 0', 'path=/bin:/sbin:/usr/bin:/usr/sbin', 'onlyif=which setenforce && getenforce | grep Enforcing')