-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make rabbitmq providers to retry the commands
W/o this fix, then RabbitMQ put in a cluster and managed, for example, by Pacemaker, rabbitmqctl/rabbitmqadmin commands could fail due to cluster is not ready yet. The solution is: 1) Add a run_with_retries method to the existing Rabbitmqctl class as a retry decorator to ensure the commands will retry instead of fail then the cluster is not ready. 2) Derive the providers from the former one to make them able to retry all of the list_* commands and, as a result, to wait for RabbitMQ ready as well. 3) Update rspecs. Add missing rspec for rabbitmq_plugin Co-authors: Dmitry Ilyin <[email protected]>, Colleen Murphy <[email protected]> Closes-bug: #MODULES-1452 Signed-off-by: Bogdan Dobrelya <[email protected]>
- Loading branch information
Bogdan Dobrelya
committed
Jan 5, 2015
1 parent
1cc2e54
commit 9b23a90
Showing
10 changed files
with
98 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
spec/unit/puppet/provider/rabbitmq_plugin/rabbitmqctl_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
require 'puppet' | ||
require 'mocha' | ||
RSpec.configure do |config| | ||
config.mock_with :mocha | ||
end | ||
provider_class = Puppet::Type.type(:rabbitmq_plugin).provider(:rabbitmqplugins) | ||
describe provider_class do | ||
before :each do | ||
@resource = Puppet::Type::Rabbitmq_plugin.new( | ||
{:name => 'foo'} | ||
) | ||
@provider = provider_class.new(@resource) | ||
end | ||
it 'should match plugins' do | ||
@provider.expects(:rabbitmqplugins).with('list', '-E', '-m').returns("foo\n") | ||
@provider.exists?.should == 'foo' | ||
end | ||
it 'should call rabbitmqplugins to enable' do | ||
@provider.expects(:rabbitmqplugins).with('enable', 'foo') | ||
@provider.create | ||
end | ||
it 'should call rabbitmqplugins to disable' do | ||
@provider.expects(:rabbitmqplugins).with('disable', 'foo') | ||
@provider.destroy | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters