Module: Cute::TakTuk
- Defined in:
- lib/cute/taktuk.rb
Overview
Cute::TakTuk is a library for controlling the execution of commands in multiple machines using taktuk tool. It exposes an API similar to that of Net::SSH:Multi, making it simpler to adapt to scripts designed with Net::SSH::Multi. It simplifies the use of taktuk by automating the generation of large command line parameters.
require 'cute/taktuk'
results = {}
Cute::TakTuk.start(['host1','host2','host3'],:user => "root") do |tak|
tak.exec("df")
results = tak.exec!("hostname")
tak.exec("ls -l")
tak.exec("sleep 20")
tak.loop()
tak.exec("tar xvf -")
tak.input(:file => "test_file.tar")
end
puts results
You can go directly to the documentation of useful methods such exec, exec!, put, input, etc.
Defined Under Namespace
Classes: Commands, Hostlist, Options, StateStream, Stream, TakTuk
Class Method Summary collapse
-
.start(host_list, opts = {}) ⇒ Object
It instantiates a new TakTuk.
-
.taktuk(*args) ⇒ Object
Execution samples:.
Class Method Details
.start(host_list, opts = {}) ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/cute/taktuk.rb', line 61 def self.start(host_list, opts={}) taktuk_cmd = TakTuk.new(host_list, opts) if block_given? begin yield taktuk_cmd taktuk_cmd.loop unless taktuk_cmd.commands.empty? taktuk_cmd.free! if taktuk_cmd taktuk_cmd = nil end else return taktuk_cmd end end |
.taktuk(*args) ⇒ Object
Execution samples:
taktuk('hostfile',:connector => 'ssh -A', :self_propagate => true).broadcast_exec['hostname'].run!
taktuk(['node-1','node-2'],:dynamic => 3).broadcast_put['myfile']['dest'].run!
taktuk(nodes).broadcast_exec['hostname'].seq!.broadcast_exec['df'].run!
taktuk(nodes).broadcast_exec['cat - | fdisk'].seq!.broadcast_input_file['fdiskdump'].run!
tak = taktuk(nodes)
tak.broadcast_exec['hostname']
tak.seq!.broadcast_exec['df']
tak.streams[:output] => OutputStream.new(Template[:line,:rank]),
tak.streams[:info] => ConnectorStream.new(Template[:command,:line])
tak.run!
46 47 48 |
# File 'lib/cute/taktuk.rb', line 46 def self.taktuk(*args) TakTuk.new(*args) end |