Skip to content

Commit

Permalink
Add support for CentOS / RHEL 9 and drop support for 7
Browse files Browse the repository at this point in the history
  • Loading branch information
wyardley committed Nov 17, 2024
1 parent b39f987 commit 083e447
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 30 deletions.
1 change: 0 additions & 1 deletion .fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
15 changes: 3 additions & 12 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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`

##### <a name="-rabbitmq--require_epel"></a>`require_epel`

Data type: `Boolean`

If this parameter is set, On CentOS / RHEL 7 systems, require the "puppet/epel" module

Default value: `true`

##### <a name="-rabbitmq--service_ensure"></a>`service_ensure`

Data type: `Enum['running', 'stopped']`
Expand Down
20 changes: 7 additions & 13 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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')
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
{
"operatingsystem": "RedHat",
"operatingsystemrelease": [
"7"
"9"
]
},
{
"operatingsystem": "CentOS",
"operatingsystemrelease": [
"7"
"9"
]
},
{
Expand Down
20 changes: 19 additions & 1 deletion spec/classes/rabbitmq_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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') }
Expand Down Expand Up @@ -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

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 @@ -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')
Expand Down

0 comments on commit 083e447

Please sign in to comment.