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.

## [v12.0.2](https://github.com/voxpupuli/puppet-rabbitmq/tree/v12.0.2) (2022-08-13)

[Full Changelog](https://github.com/voxpupuli/puppet-rabbitmq/compare/v12.0.1...v12.0.2)

**Fixed bugs:**

- rabbitmq\_plugin not working properly with RabbitMQ 3.10.x [\#909](https://github.com/voxpupuli/puppet-rabbitmq/issues/909)

**Merged pull requests:**

- Make rabbitmq\_plugin resource functional on RabbitMQ 3.10.x [\#912](https://github.com/voxpupuli/puppet-rabbitmq/pull/912) ([kvisle](https://github.com/kvisle))
- Update tests for rabbitmqctl version parsing [\#911](https://github.com/voxpupuli/puppet-rabbitmq/pull/911) ([wyardley](https://github.com/wyardley))

## [v12.0.1](https://github.com/voxpupuli/puppet-rabbitmq/tree/v12.0.1) (2022-06-17)

[Full Changelog](https://github.com/voxpupuli/puppet-rabbitmq/compare/v12.0.0...v12.0.1)
Expand Down
1 change: 1 addition & 0 deletions lib/puppet/provider/rabbitmq_plugin/rabbitmqplugins.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def self.instances
end

plugin_list.split(%r{\n}).map do |line|
next if line.start_with?('Listing plugins')
raise Puppet::Error, "Cannot parse invalid plugins line: #{line}" unless line =~ %r{^(\S+)$}

new(name: Regexp.last_match(1))
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "puppet-rabbitmq",
"version": "12.0.1",
"version": "12.0.2",
"author": "voxpupuli",
"summary": "Installs, configures, and manages RabbitMQ.",
"license": "Apache-2.0",
Expand Down
11 changes: 8 additions & 3 deletions spec/unit/puppet/provider/rabbitmq_cli_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,23 @@
end

it 'gets the RabbitMQ version' do
provider_class.expects(:rabbitmqctl).with('-q', 'status').returns '{rabbit,"RabbitMQ","3.1.5"}'
expect(provider_class.rabbitmq_version).to eq('3.1.5')
provider_class.expects(:rabbitmqctl).with('-q', 'status').returns ' [{rabbit,"RabbitMQ","3.7.28"},'
expect(provider_class.rabbitmq_version).to eq('3.7.28')
end

it 'caches the RabbitMQ version' do
provider_class.expects(:rabbitmqctl).with('-q', 'status').returns '{rabbit,"RabbitMQ","3.7.10"}'
provider_class.expects(:rabbitmqctl).with('-q', 'status').returns ' [{rabbit,"RabbitMQ","3.7.28"},'
v1 = provider_class.rabbitmq_version

# No second expects for rabbitmqctl as it shouldn't be called again
expect(provider_class.rabbitmq_version).to eq(v1)
end

it 'gets the RabbitMQ version with version >= 3.8' do
provider_class.expects(:rabbitmqctl).with('-q', 'status').returns 'RabbitMQ version: 3.10.6'
expect(provider_class.rabbitmq_version).to eq('3.10.6')
end

it 'uses correct list options with RabbitMQ < 3.7.9' do
provider_class.expects(:rabbitmq_version).returns '3.7.8'
provider_class.expects(:rabbitmqctl).with('list_vhost', '-q').returns ''
Expand Down
10 changes: 10 additions & 0 deletions spec/unit/puppet/provider/rabbitmq_plugin/rabbitmqctl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@
provider.create
end

context 'with RabbitMQ version >=3.10.0' do
it 'matches plugins' do
provider.expects(:rabbitmqplugins).with('list', '-E', '-m').returns <<~EOT
Listing plugins with pattern ".*" ...
foo
EOT
expect(provider.exists?).to eq(true)
end
end

context 'with RabbitMQ version >=3.4.0' do
it 'calls rabbitmqplugins to enable' do
provider.class.expects(:rabbitmq_version).returns '3.4.0'
Expand Down