libraries/kapacitor_api.rb
# Retry limited number of time a block catching only specific exceptions
# opts:
#   :tries - Integer - number of time to retry the block (required)
#   :exceptions - Exception or Array of Exception - exceptions to catch (required)
Retry limited number of time a block catching only specific exceptions
opts:
:tries - Integer - number of time to retry the block (required)
:exceptions - Exception or Array of Exception - exceptions to catch (required)
Retry limited number of time a block catching only specific exceptions opts : : tries - Integer - number of time to retry the block ( required ) : exceptions - Exception or Array of Exception - exceptions to catch ( required )
def with_limited_retry(opts)
      tries = opts.fetch :tries
      exceptions = Array(opts.fetch(:exceptions))
      return if tries == 0
      begin
        yield
      rescue *exceptions
        Chef::Log.warn('Bad response, try again...')
        if (tries -= 1) > 0
          sleep 1
          retry
        end
      end
    end
def with_limited_retry ( opts ) tries = opts . fetch :tries exceptions = Array ( opts . fetch ( :exceptions ) ) return if tries == 0 begin yield rescue * exceptions Chef :: Log . warn ( 'Bad response, try again...' ) if ( tries -= 1 ) > 0 sleep 1 retry end end end
Retry limited number of time a block catching only specific exceptions
opts:
:tries - Integer - number of time to retry the block (required)
:exceptions - Exception or Array of Exception - exceptions to catch (required)
Retry limited number of time a block catching only specific exceptions opts : : tries - Integer - number of time to retry the block ( required ) : exceptions - Exception or Array of Exception - exceptions to catch ( required )
opts
<not_specific>