1 class Puppet::Provider::Rabbitmqctl < Puppet::Provider
3 commands :rabbitmqctl => 'rabbitmqctl'
5 def self.rabbitmq_version
6 output = rabbitmqctl('-q', 'status')
7 version = output.match(/\{rabbit,"RabbitMQ","([\d\.]+)"\}/)
11 # Retry the given code block 'count' retries or until the
12 # command suceeeds. Use 'step' delay between retries.
13 # Limit each query time by 'timeout'.
15 # users = self.class.run_with_retries { rabbitmqctl 'list_users' }
16 def self.run_with_retries(count=30, step=6, timeout=10)
19 output = Timeout::timeout(timeout) do
22 rescue Puppet::ExecutionFailure, Timeout
23 Puppet.debug 'Command failed, retrying'
26 Puppet.debug 'Command succeeded'
30 raise Puppet::Error, "Command is still failing after #{count * step} seconds expired!"