Skip to content

Commit 6bdbbd3

Browse files
authored
Merge pull request #1034 from wyardley/wyardley/centos_rhel_release
Add `enable_centos_release` parameter
2 parents 133bfa6 + c6d20d7 commit 6bdbbd3

File tree

4 files changed

+24
-2
lines changed

4 files changed

+24
-2
lines changed

REFERENCE.md

+10
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ The following parameters are available in the `rabbitmq` class:
219219
* [`default_user`](#-rabbitmq--default_user)
220220
* [`default_pass`](#-rabbitmq--default_pass)
221221
* [`delete_guest_user`](#-rabbitmq--delete_guest_user)
222+
* [`enable_centos_release`](#-rabbitmq--enable_centos_release)
222223
* [`env_config`](#-rabbitmq--env_config)
223224
* [`env_config_path`](#-rabbitmq--env_config_path)
224225
* [`environment_variables`](#-rabbitmq--environment_variables)
@@ -508,6 +509,15 @@ Controls whether default guest user is deleted.
508509

509510
Default value: `false`
510511

512+
##### <a name="-rabbitmq--enable_centos_release"></a>`enable_centos_release`
513+
514+
Data type: `Boolean`
515+
516+
Enable the `centos-release-rabbitmq-38` if set to `true` and if the OS is in the
517+
RedHat family and `repos_ensure` is `false`. Defaults to true on CentOS.
518+
519+
Default value: `false`
520+
511521
##### <a name="-rabbitmq--env_config"></a>`env_config`
512522

513523
Data type: `String`

data/os/CentOS.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rabbitmq::enable_centos_release: true

manifests/init.pp

+5-1
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,9 @@
161161
# Password to set for the `default_user` in rabbitmq.config.
162162
# @param delete_guest_user
163163
# Controls whether default guest user is deleted.
164+
# @param enable_centos_release
165+
# Enable the `centos-release-rabbitmq-38` if set to `true` and if the OS is in the
166+
# RedHat family and `repos_ensure` is `false`. Defaults to true on CentOS.
164167
# @param env_config
165168
# The template file to use for rabbitmq_env.config.
166169
# @param env_config_path
@@ -369,6 +372,7 @@
369372
String $default_user = 'guest',
370373
String $default_pass = 'guest',
371374
Boolean $delete_guest_user = false,
375+
Boolean $enable_centos_release = false,
372376
String $env_config = 'rabbitmq/rabbitmq-env.conf.epp',
373377
Stdlib::Absolutepath $env_config_path = '/etc/rabbitmq/rabbitmq-env.conf',
374378
Optional[String] $erlang_cookie = undef,
@@ -513,7 +517,7 @@
513517
default: {
514518
}
515519
}
516-
} elsif $facts['os']['family'] == 'RedHat' {
520+
} elsif $facts['os']['family'] == 'RedHat' and $enable_centos_release {
517521
package { 'centos-release-rabbitmq-38':
518522
ensure => 'present',
519523
}

spec/classes/rabbitmq_spec.rb

+8-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@
3939
it { is_expected.not_to contain_class('rabbitmq::repo::rhel') }
4040
it { is_expected.not_to contain_yumrepo('rabbitmq') }
4141

42-
it { is_expected.to contain_package('centos-release-rabbitmq-38') } if os_facts['os']['family'] == 'RedHat'
42+
it { is_expected.to contain_package('centos-release-rabbitmq-38') } if os_facts['os']['name'] == 'CentOS'
43+
it { is_expected.not_to contain_package('centos-release-rabbitmq-38') } if os_facts['os']['name'] == 'RedHat'
4344
end
4445

4546
context 'with service_restart => false' do
@@ -48,6 +49,12 @@
4849
it { is_expected.not_to contain_class('rabbitmq::config').that_notifies('Class[rabbitmq::service]') }
4950
end
5051

52+
context 'with enable_centos_release set to false' do
53+
let(:params) { { enable_centos_release: false } }
54+
55+
it { is_expected.not_to contain_package('centos-release-rabbitmq-38') } if os_facts['os']['family'] == 'RedHat'
56+
end
57+
5158
context 'with repos_ensure => true' do
5259
let(:params) { { repos_ensure: true } }
5360

0 commit comments

Comments
 (0)