Class: Expectacle::Thrower

Inherits:
ThrowerBase show all
Defined in:
lib/expectacle/thrower.rb

Overview

Thrower logic(command list operation)

Instance Attribute Summary

Attributes inherited from ThrowerBase

#base_dir, #logger

Instance Method Summary collapse

Methods inherited from ThrowerBase

#commands_dir, #hosts_dir, #initialize, #prompts_dir, #setup_logger

Constructor Details

This class inherits a constructor from Expectacle::ThrowerBase

Instance Method Details

#preview_parameter(hosts, commands) ⇒ Object

Preview all parameters for all hosts.

Parameters:

  • hosts (Array<Hash>)

    Host parameters (read from host list file).

  • commands (Array<String>)

    Commands (read from command list file).



22
23
24
25
26
27
28
# File 'lib/expectacle/thrower.rb', line 22

def preview_parameter(hosts, commands)
  @commands = commands
  hosts.each do |each|
    @host_param = each
    preview_command_for_host
  end
end

#run_command_for_all_hosts(hosts, commands) ⇒ Object

Run(exec) commands for all hosts.

Parameters:

  • hosts (Array<Hash>)

    Host parameters (read from host list file).

  • commands (Array<String>)

    Commands (read from command list file).



11
12
13
14
15
16
17
# File 'lib/expectacle/thrower.rb', line 11

def run_command_for_all_hosts(hosts, commands)
  hosts.each do |each|
    @commands = commands.dup # Notice: @commands will be decremented.
    @host_param = each
    run_command_for_host
  end
end