Skip to content

Commit 82010fc

Browse files
authored
Merge pull request #1027 from wyardley/wyardley/centos-9
Add support for CentOS / RHEL 9 and drop support for 7
2 parents b39f987 + e79b555 commit 82010fc

File tree

6 files changed

+31
-30
lines changed

6 files changed

+31
-30
lines changed

.fixtures.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,5 @@ fixtures:
44
stdlib: 'https://github.com/puppetlabs/puppetlabs-stdlib'
55
apt: 'https://github.com/puppetlabs/puppetlabs-apt'
66
archive: 'https://github.com/voxpupuli/puppet-archive'
7-
epel: 'https://github.com/voxpupuli/puppet-epel'
87
systemd: 'https://github.com/voxpupuli/puppet-systemd'
98
yumrepo_core: 'https://github.com/puppetlabs/puppetlabs-yumrepo_core'

REFERENCE.md

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,6 @@ The following parameters are available in the `rabbitmq` class:
255255
* [`port`](#-rabbitmq--port)
256256
* [`python_package`](#-rabbitmq--python_package)
257257
* [`repos_ensure`](#-rabbitmq--repos_ensure)
258-
* [`require_epel`](#-rabbitmq--require_epel)
259258
* [`service_ensure`](#-rabbitmq--service_ensure)
260259
* [`service_manage`](#-rabbitmq--service_manage)
261260
* [`service_name`](#-rabbitmq--service_name)
@@ -805,20 +804,12 @@ Default value: `'python'`
805804
Data type: `Boolean`
806805

807806
Ensure that a repo with the official (and newer) RabbitMQ package is configured, along with its signing key.
808-
Defaults to false (use system packages). This does not ensure that soft dependencies (like EPEL on RHEL systems) are present.
809-
It also does not solve the erlang dependency. See https://www.rabbitmq.com/which-erlang.html for a good breakdown of the
810-
different ways of handling the erlang deps. See also https://github.com/voxpupuli/puppet-rabbitmq/issues/788
807+
Defaults to false (use system packages). This does not ensure that soft dependencies are present.
808+
It also does not solve the erlang dependency. See https://www.rabbitmq.com/which-erlang.html for a good breakdown of the
809+
different ways of handling the erlang deps. See also https://github.com/voxpupuli/puppet-rabbitmq/issues/788
811810

812811
Default value: `false`
813812

814-
##### <a name="-rabbitmq--require_epel"></a>`require_epel`
815-
816-
Data type: `Boolean`
817-
818-
If this parameter is set, On CentOS / RHEL 7 systems, require the "puppet/epel" module
819-
820-
Default value: `true`
821-
822813
##### <a name="-rabbitmq--service_ensure"></a>`service_ensure`
823814

824815
Data type: `Enum['running', 'stopped']`

manifests/init.pp

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -242,11 +242,9 @@
242242
# Name of the package required by rabbitmqadmin.
243243
# @param repos_ensure
244244
# Ensure that a repo with the official (and newer) RabbitMQ package is configured, along with its signing key.
245-
# Defaults to false (use system packages). This does not ensure that soft dependencies (like EPEL on RHEL systems) are present.
246-
# It also does not solve the erlang dependency. See https://www.rabbitmq.com/which-erlang.html for a good breakdown of the
247-
# different ways of handling the erlang deps. See also https://github.com/voxpupuli/puppet-rabbitmq/issues/788
248-
# @param require_epel
249-
# If this parameter is set, On CentOS / RHEL 7 systems, require the "puppet/epel" module
245+
# Defaults to false (use system packages). This does not ensure that soft dependencies are present.
246+
# It also does not solve the erlang dependency. See https://www.rabbitmq.com/which-erlang.html for a good breakdown of the
247+
# different ways of handling the erlang deps. See also https://github.com/voxpupuli/puppet-rabbitmq/issues/788
250248
# @param service_ensure
251249
# The state of the service.
252250
# @param service_manage
@@ -461,7 +459,6 @@
461459
Array $archive_options = [],
462460
Array $loopback_users = ['guest'],
463461
Boolean $service_restart = true,
464-
Boolean $require_epel = true,
465462
) {
466463
if $ssl_only and ! $ssl {
467464
fail('$ssl_only => true requires that $ssl => true')
@@ -516,13 +513,10 @@
516513
default: {
517514
}
518515
}
519-
} elsif ($facts['os']['family'] == 'RedHat' and $facts['os']['release']['major'] == '7') and $require_epel {
520-
# On later CentOS / RHEL systems, this is not useful since EPEL doesn't
521-
# have the rabbitmq-server package anyway.
522-
#
523-
# Once support for 7 is dropped, we should remove this code and the
524-
# parameter
525-
require epel
516+
} elsif $facts['os']['family'] == 'RedHat' {
517+
package { 'centos-release-rabbitmq-38':
518+
ensure => 'present',
519+
}
526520
}
527521

528522
contain rabbitmq::install

metadata.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
{
1212
"operatingsystem": "RedHat",
1313
"operatingsystemrelease": [
14-
"7"
14+
"9"
1515
]
1616
},
1717
{
1818
"operatingsystem": "CentOS",
1919
"operatingsystemrelease": [
20-
"7"
20+
"9"
2121
]
2222
},
2323
{

spec/classes/rabbitmq_spec.rb

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
it { is_expected.not_to contain_apt__source('rabbitmq') }
3939
it { is_expected.not_to contain_class('rabbitmq::repo::rhel') }
4040
it { is_expected.not_to contain_yumrepo('rabbitmq') }
41+
42+
it { is_expected.to contain_package('centos-release-rabbitmq-38') } if os_facts['os']['family'] == 'RedHat'
4143
end
4244

4345
context 'with service_restart => false' do
@@ -77,6 +79,19 @@
7779
with_baseurl(%r{https://packagecloud.io/rabbitmq/rabbitmq-server/el/\d+/\$basearch$}).
7880
with_gpgkey('https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey')
7981
end
82+
83+
it {
84+
is_expected.to contain_exec('rpm --import https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc').with(
85+
unless: 'rpm -q gpg-pubkey-6026dfca-573adfde 2>/dev/null'
86+
)
87+
}
88+
89+
it {
90+
is_expected.to contain_exec('rpm --import https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey').with(
91+
unless: 'rpm -q gpg-pubkey-4d206f89-5bbb8d59 2>/dev/null'
92+
)
93+
}
94+
8095
else
8196
it { is_expected.not_to contain_class('rabbitmq::repo::rhel') }
8297
it { is_expected.not_to contain_yumrepo('rabbitmq') }
@@ -189,7 +204,10 @@
189204
notify: 'Class[Rabbitmq::Service]'
190205
)
191206
is_expected.to contain_archive('rabbitmqadmin').with_source('http://1.1.1.1:15672/cli/rabbitmqadmin')
192-
is_expected.to contain_file('/usr/local/bin/rabbitmqadmin').with_owner('root').with_mode('0755')
207+
is_expected.to contain_file('/usr/local/bin/rabbitmqadmin').with(
208+
owner: 'root',
209+
mode: '0755'
210+
)
193211
is_expected.to contain_exec('remove_old_rabbitmqadmin_on_upgrade').with_command("rm #{rabbitmq_home}/rabbitmqadmin")
194212
end
195213

spec/spec_helper_acceptance.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
when 'Debian'
88
install_puppet_module_via_pmt_on(host, 'puppetlabs-apt', '>= 9.0.0 < 10.0.0')
99
when 'RedHat'
10-
install_puppet_module_via_pmt_on(host, 'puppet-epel', '>= 5.0.0 < 6.0.0')
1110
if fact_on(host, 'os.selinux.enabled')
1211
# Make sure selinux is disabled so the tests work.
1312
on host, puppet('resource', 'exec', 'setenforce 0', 'path=/bin:/sbin:/usr/bin:/usr/sbin', 'onlyif=which setenforce && getenforce | grep Enforcing')

0 commit comments

Comments
 (0)