Class: Blender::Driver::SshMulti

Inherits:
Ssh
  • Object
show all
Defined in:
lib/blender/drivers/ssh_multi.rb

Instance Attribute Summary

Attributes inherited from Ssh

#user

Attributes inherited from Base

#config, #events, #stderr, #stdout

Instance Method Summary collapse

Methods inherited from Ssh

#initialize, #run_command

Methods included from SSHExec

#fixup_sudo, #remote_exec

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Blender::Driver::Ssh

Instance Method Details

#concurrencyObject



40
41
42
# File 'lib/blender/drivers/ssh_multi.rb', line 40

def concurrency
  @config[:concurrency]
end

#execute(tasks, hosts) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/blender/drivers/ssh_multi.rb', line 27

def execute(tasks, hosts)
  Log.debug("SSH execution tasks [#{tasks.size}]")
  Log.debug("SSH on hosts [#{hosts.join("\n")}]")
  session = create_session(hosts)
  Array(tasks).each do |task|
    cmd = run_command(task.command, session)
    if cmd.exitstatus != 0 and !task.[:ignore_failure]
      raise ExecutionFailed, cmd.stderr
    end
  end
  session.loop
end