Class: Roma::MultiCommander
- Inherits:
-
Object
- Object
- Roma::MultiCommander
- Defined in:
- lib/roma/tools/multi_commander.rb
Instance Method Summary collapse
-
#initialize(nid) ⇒ MultiCommander
constructor
A new instance of MultiCommander.
- #send_cmd(cmd, nid = nil) ⇒ Object
- #send_cmd_all(cmd) ⇒ Object
Constructor Details
#initialize(nid) ⇒ MultiCommander
Returns a new instance of MultiCommander.
21 22 23 24 |
# File 'lib/roma/tools/multi_commander.rb', line 21 def initialize(nid) @sender = Roma::Client::Sender.new @rd = @sender.send_routedump_command(nid) end |
Instance Method Details
#send_cmd(cmd, nid = nil) ⇒ Object
26 27 28 29 30 31 |
# File 'lib/roma/tools/multi_commander.rb', line 26 def send_cmd(cmd, nid = nil) nid = @rd.nodes[0] unless nid res = '' res << @sender.send_command(nid, cmd, nil, :multiplelines_receiver2).join("\r\n") res << "\r\n" end |
#send_cmd_all(cmd) ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'lib/roma/tools/multi_commander.rb', line 33 def send_cmd_all(cmd) res = '' @rd.nodes.each{|nid| res << "****** #{nid}\r\n" res << send_cmd(cmd, nid) } res end |