class Warg::Executor::Deferred

Public Class Methods

new(command, run_object, hosts, order, &setup) click to toggle source
# File lib/warg.rb, line 1622
def initialize(command, run_object, hosts, order, &setup)
  @command = command
  @run_object = run_object
  @hosts = hosts
  @order = order
  @setup = setup

  @callbacks_queue = CallbacksQueue.new(order)

  @run_type = case @run_object
              when Script
                :run_script
              when String
                :run_command
              when Localhost::BlockProxy
                :run_block
              end
end

Public Instance Methods

and_then(&block) click to toggle source
# File lib/warg.rb, line 1645
def and_then(&block)
  @callbacks_queue << block
  self
end
banner() click to toggle source
run() click to toggle source
# File lib/warg.rb, line 1650
def run
  execution_result = @hosts.public_send(@run_type, @run_object, order: @order, &@setup)

  execution_result = @callbacks_queue.drain(execution_result)

  if execution_result.failed?
    @command.on_failure(execution_result)
  end

  execution_result
end