12 changes: 10 additions & 2 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,15 +245,23 @@ with:
BEAKER_PUPPET_COLLECTION=puppet7 BEAKER_setfile=debian11-64 bundle exec rake beaker
```

or

```sh
BEAKER_PUPPET_COLLECTION=none BEAKER_setfile=archlinux-64 bundle exec rake beaker
```

This latter example will use the distribution's own version of Puppet.

You can replace the string `debian11` with any common operating system.
The following strings are known to work:

* ubuntu2004
* ubuntu2204
* debian11
* centos7
* centos8
* debian12
* centos9
* archlinux
* almalinux8
* almalinux9
* fedora36
Expand Down
3 changes: 3 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
---
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/

skip-changelog:
- head-branch: ['^release-*', 'release']
42 changes: 42 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/

# https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes

changelog:
exclude:
labels:
- duplicate
- invalid
- modulesync
- question
- skip-changelog
- wont-fix
- wontfix

categories:
- title: Breaking Changes 🛠
labels:
- backwards-incompatible

- title: New Features 🎉
labels:
- enhancement

- title: Bug Fixes 🐛
labels:
- bug

- title: Documentation Updates 📚
labels:
- documentation
- docs

- title: Dependency Updates ⬆️
labels:
- dependencies

- title: Other Changes
labels:
- "*"
17 changes: 17 additions & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/

name: "Pull Request Labeler"

on:
pull_request_target: {}

jobs:
labeler:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v5
7 changes: 7 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,10 @@ jobs:
# https://docs.github.com/en/actions/security-guides/encrypted-secrets
username: ${{ secrets.PUPPET_FORGE_USERNAME }}
api_key: ${{ secrets.PUPPET_FORGE_API_KEY }}

create-github-release:
name: Create GitHub Release
runs-on: ubuntu-latest
steps:
- name: Create GitHub release
uses: voxpupuli/gha-create-a-github-release@v1
2 changes: 1 addition & 1 deletion .msync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/

modulesync_config_version: '9.0.0'
modulesync_config_version: '9.1.0'
3 changes: 3 additions & 0 deletions .puppet-lint.rc
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/

--fail-on-warnings
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@ All notable changes to this project will be documented in this file.
Each new release typically also includes the latest modulesync defaults.
These should not affect the functionality of the module.

## [v13.7.0](https://github.com/voxpupuli/puppet-rabbitmq/tree/v13.7.0) (2024-09-06)

[Full Changelog](https://github.com/voxpupuli/puppet-rabbitmq/compare/v13.6.0...v13.7.0)

**Implemented enhancements:**

- Add support for Ubuntu 20 and 22 [\#1015](https://github.com/voxpupuli/puppet-rabbitmq/pull/1015) ([wyardley](https://github.com/wyardley))
- Add support for cowboy\_opts config in rabbitmq.config [\#1013](https://github.com/voxpupuli/puppet-rabbitmq/pull/1013) ([SpinEternel](https://github.com/SpinEternel))

**Fixed bugs:**

- Convert `queue-version` to integer [\#1019](https://github.com/voxpupuli/puppet-rabbitmq/pull/1019) ([wyardley](https://github.com/wyardley))

## [v13.6.0](https://github.com/voxpupuli/puppet-rabbitmq/tree/v13.6.0) (2024-06-28)

[Full Changelog](https://github.com/voxpupuli/puppet-rabbitmq/compare/v13.5.1...v13.6.0)
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
source ENV['GEM_SOURCE'] || 'https://rubygems.org'

group :test do
gem 'voxpupuli-test', '~> 8.0', :require => false
gem 'voxpupuli-test', '~> 9.0', :require => false
gem 'coveralls', :require => false
gem 'simplecov-console', :require => false
gem 'puppet_metadata', '~> 4.0', :require => false
Expand Down
9 changes: 9 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ The following parameters are available in the `rabbitmq` class:
* [`config`](#-rabbitmq--config)
* [`config_additional_variables`](#-rabbitmq--config_additional_variables)
* [`config_cluster`](#-rabbitmq--config_cluster)
* [`config_cowboy_opts`](#-rabbitmq--config_cowboy_opts)
* [`config_kernel_variables`](#-rabbitmq--config_kernel_variables)
* [`config_path`](#-rabbitmq--config_path)
* [`config_ranch`](#-rabbitmq--config_ranch)
Expand Down Expand Up @@ -411,6 +412,14 @@ Enable or disable clustering support.

Default value: `false`

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

Data type: `Hash`

Hash of additional configs (key / value) for `cowboy_opts` in rabbitmq.config.

Default value: `{}`

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

Data type: `Hash`
Expand Down
1 change: 1 addition & 0 deletions lib/puppet/type/rabbitmq_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
max-length
max-length-bytes
message-ttl
queue-version
shards-per-node
].freeze

Expand Down
1 change: 1 addition & 0 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
$cluster_nodes = $rabbitmq::cluster_nodes
$config = $rabbitmq::config
$config_cluster = $rabbitmq::config_cluster
$config_cowboy_opts = $rabbitmq::config_cowboy_opts
$config_path = $rabbitmq::config_path
$config_ranch = $rabbitmq::config_ranch
$config_stomp = $rabbitmq::config_stomp
Expand Down
3 changes: 3 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@
# Additional config variables in rabbitmq.config
# @param config_cluster
# Enable or disable clustering support.
# @param config_cowboy_opts
# Hash of additional configs (key / value) for `cowboy_opts` in rabbitmq.config.
# @param config_kernel_variables
# Hash of Erlang kernel configuration variables to set (see [Variables Configurable in rabbitmq.config](#variables-configurable-in-rabbitmq.config)).
# @param config_path
Expand Down Expand Up @@ -357,6 +359,7 @@
Enum['ram', 'disc'] $cluster_node_type = 'disc',
Array $cluster_nodes = [],
String $config = 'rabbitmq/rabbitmq.config.epp',
Hash $config_cowboy_opts = {},
Boolean $config_cluster = false,
Stdlib::Absolutepath $config_path = '/etc/rabbitmq/rabbitmq.config',
Boolean $config_ranch = true,
Expand Down
6 changes: 4 additions & 2 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{

Check warning on line 1 in metadata.json

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

Skipping EOL operating system RedHat 7

Check warning on line 1 in metadata.json

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

Skipping EOL operating system CentOS 7

Check warning on line 1 in metadata.json

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

Skipping EOL operating system Debian 10

Check warning on line 1 in metadata.json

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

Skipping EOL operating system Ubuntu 18.04

Check warning on line 1 in metadata.json

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

Skipping EOL operating system FreeBSD 12
"name": "puppet-rabbitmq",
"version": "13.6.0",
"version": "13.7.0",
"author": "Vox Pupuli",
"summary": "Installs, configures, and manages RabbitMQ.",
"license": "Apache-2.0",
Expand Down Expand Up @@ -30,7 +30,9 @@
{
"operatingsystem": "Ubuntu",
"operatingsystemrelease": [
"18.04"
"18.04",
"20.04",
"22.04"
]
},
{
Expand Down
44 changes: 44 additions & 0 deletions spec/classes/rabbitmq_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,50 @@
end
end

describe 'with config_cowboy_opts' do
context 'without SSL' do
let(:params) do
{
config_cowboy_opts: {
'max_request_line_length' => 16_000,
'max_keepalive' => 1000,
},
}
end

it 'sets expected cowboy config variables' do
is_expected.to contain_file('rabbitmq.config'). \
with_content(
%r{\{cowboy_opts, \[\n\s+\{max_keepalive, 1000\},\n\s+\{max_request_line_length, 16000\}}
)
end
end

context 'withSSL' do
let(:params) do
{
config_cowboy_opts: {
'max_request_line_length' => 16_003,
'max_keepalive' => 1002,
},
ssl: true,
ssl_port: 3141,
ssl_cacert: '/path/to/cacert',
ssl_cert: '/path/to/cert',
ssl_key: '/path/to/key',
ssl_versions: ['tlsv1.2', 'tlsv1.1'],
}
end

it 'sets expected cowboy config variables' do
is_expected.to contain_file('rabbitmq.config'). \
with_content(
%r{\{cowboy_opts, \[\n\s+\{max_keepalive, 1002\},\n\s+\{max_request_line_length, 16003\}}
)
end
end
end

describe 'rabbitmq-env configuration' do
context 'with default params' do
it 'sets environment variables' do
Expand Down
9 changes: 5 additions & 4 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/

RSpec.configure do |c|
c.mock_with :mocha
end

# puppetlabs_spec_helper will set up coverage if the env variable is set.
# We want to do this if lib exists and it hasn't been explicitly set.
ENV['COVERAGE'] ||= 'yes' if Dir.exist?(File.expand_path('../lib', __dir__))

require 'voxpupuli/test/spec_helper'

RSpec.configure do |c|
c.facterdb_string_keys = false
c.mock_with :mocha
end

add_mocked_facts!

if File.exist?(File.join(__dir__, 'default_module_facts.yml'))
Expand Down
13 changes: 13 additions & 0 deletions spec/unit/puppet/type/rabbitmq_policy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,19 @@
end.to raise_error(Puppet::Error, %r{Invalid initial-cluster-size value 'impressive})
end

it 'accepts and converts the queue-version value' do
definition = { 'queue-version' => '2' }
policy[:definition] = definition
expect(policy[:definition]['queue-version']).to eq(2)
end

it 'does not accept non-numeric queue-version value' do
definition = { 'queue-version' => 'oogabooga' }
expect do
policy[:definition] = definition
end.to raise_error(Puppet::Error, %r{Invalid queue-version value.*oogabooga})
end

context 'accepts list value in ha-params when ha-mode = nodes' do
before do
policy[:definition] = definition
Expand Down
12 changes: 11 additions & 1 deletion templates/rabbitmq.config.epp
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,13 @@
{ip, "<%= $rabbitmq::config::management_ip_address %>"},
<%- } -%>
{port, <%= $rabbitmq::config::ssl_management_port %>},
<%- if !$rabbitmq::config::config_cowboy_opts.empty {-%>
{cowboy_opts, [
<%- $rabbitmq::config::config_cowboy_opts.keys.sort.each |$k| { -%>
{<%= $k %>, <%= $rabbitmq::config::config_cowboy_opts[$k] %>}<% if $k != $rabbitmq::config::config_cowboy_opts.keys.sort[-1] { %>,<%- } %>
<%- } -%>
]},
<%- } -%>
{ssl, true},
{ssl_opts, [
<%- if $rabbitmq::config::ssl_management_cacert {-%>
Expand Down Expand Up @@ -164,7 +171,10 @@
<%- if $rabbitmq::config::management_ip_address {-%>
{ip, "<%= $rabbitmq::config::management_ip_address %>"},
<%- } -%>
{port, <%= $rabbitmq::config::management_port %>}
{port, <%= $rabbitmq::config::management_port %>}<% if !$rabbitmq::config::config_cowboy_opts.empty {%>,
{cowboy_opts, [<%- $rabbitmq::config::config_cowboy_opts.keys.sort.each |$k| { %>
{<%= $k %>, <%= $rabbitmq::config::config_cowboy_opts[$k] %>}<% if $k != $rabbitmq::config::config_cowboy_opts.keys.sort[-1] { %>,<%- }} %>
]}<%- } %>
<%- } -%>
]}
<%- } -%>
Expand Down