lib/omnibus/builder.rb
def with_retries(&block)
      tries = Config.build_retries
      delay = 5
      exceptions = [CommandFailed, CommandTimeout]

      begin
        yield
      rescue *exceptions => e
        if tries <= 0
          raise e
        else
          delay *= 2

          log.warn(log_key) do
            label = "#{(Config.build_retries - tries) + 1}/#{Config.build_retries}"
            "[#{label}] Failed to execute command. Retrying in #{delay} seconds..."
          end

          sleep(delay)
          tries -= 1
          retry
        end
      end
    end
def with_retries(&block)
      tries = Config.build_retries
      delay = 5
      exceptions = [CommandFailed, CommandTimeout]

      begin
        yield
      rescue *exceptions => e
        if tries <= 0
          raise e
        else
          delay *= 2

          log.warn(log_key) do
            label = "#{(Config.build_retries - tries) + 1}/#{Config.build_retries}"
            "[#{label}] Failed to execute command. Retrying in #{delay} seconds..."
          end

          sleep(delay)
          tries -= 1
          retry
        end
      end
    end
Execute the given block with (n) reties defined by {Config#build_retries}.
 This method will only retry for the following exceptions:

   - +CommandFailed+
   - +CommandTimeout+

 @param [Proc] block
   the block to execute