Skip to content

Commit

Permalink
Merge pull request #912 from kvisle/bugfix/plugin_resource_broken_310
Browse files Browse the repository at this point in the history
Make rabbitmq_plugin resource functional on RabbitMQ 3.10.x
  • Loading branch information
wyardley authored Aug 13, 2022
2 parents 277e3e8 + 3436f22 commit 3f811e5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
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
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

0 comments on commit 3f811e5

Please sign in to comment.