Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add enable_centos_release parameter #1034

Merged
merged 1 commit into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ The following parameters are available in the `rabbitmq` class:
* [`default_user`](#-rabbitmq--default_user)
* [`default_pass`](#-rabbitmq--default_pass)
* [`delete_guest_user`](#-rabbitmq--delete_guest_user)
* [`enable_centos_release`](#-rabbitmq--enable_centos_release)
* [`env_config`](#-rabbitmq--env_config)
* [`env_config_path`](#-rabbitmq--env_config_path)
* [`environment_variables`](#-rabbitmq--environment_variables)
Expand Down Expand Up @@ -508,6 +509,15 @@ Controls whether default guest user is deleted.

Default value: `false`

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

Data type: `Boolean`

Enable the `centos-release-rabbitmq-38` if set to `true` and if the OS is in the
RedHat family and `repos_ensure` is `false`. Defaults to true on CentOS.

Default value: `false`

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

Data type: `String`
Expand Down
1 change: 1 addition & 0 deletions data/os/CentOS.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rabbitmq::enable_centos_release: true
6 changes: 5 additions & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@
# Password to set for the `default_user` in rabbitmq.config.
# @param delete_guest_user
# Controls whether default guest user is deleted.
# @param enable_centos_release
# Enable the `centos-release-rabbitmq-38` if set to `true` and if the OS is in the
# RedHat family and `repos_ensure` is `false`. Defaults to true on CentOS.
# @param env_config
# The template file to use for rabbitmq_env.config.
# @param env_config_path
Expand Down Expand Up @@ -369,6 +372,7 @@
String $default_user = 'guest',
String $default_pass = 'guest',
Boolean $delete_guest_user = false,
Boolean $enable_centos_release = false,
String $env_config = 'rabbitmq/rabbitmq-env.conf.epp',
Stdlib::Absolutepath $env_config_path = '/etc/rabbitmq/rabbitmq-env.conf',
Optional[String] $erlang_cookie = undef,
Expand Down Expand Up @@ -513,7 +517,7 @@
default: {
}
}
} elsif $facts['os']['family'] == 'RedHat' {
} elsif $facts['os']['family'] == 'RedHat' and $enable_centos_release {
package { 'centos-release-rabbitmq-38':
ensure => 'present',
}
Expand Down
9 changes: 8 additions & 1 deletion spec/classes/rabbitmq_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
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'
it { is_expected.to contain_package('centos-release-rabbitmq-38') } if os_facts['os']['name'] == 'CentOS'
it { is_expected.not_to contain_package('centos-release-rabbitmq-38') } if os_facts['os']['name'] == 'RedHat'
end

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

context 'with enable_centos_release set to false' do
let(:params) { { enable_centos_release: false } }

it { is_expected.not_to contain_package('centos-release-rabbitmq-38') } if os_facts['os']['family'] == 'RedHat'
end

context 'with repos_ensure => true' do
let(:params) { { repos_ensure: true } }

Expand Down
Loading