class Roma::MultiCommander
Public Class Methods
new(nid)
click to toggle source
# File lib/roma/tools/multi_commander.rb 21 def initialize(nid) 22 @sender = Roma::Client::Sender.new 23 @rd = @sender.send_routedump_command(nid) 24 end
Public Instance Methods
multiplelines_receiver2(con)
click to toggle source
# File lib/roma/tools/multi_commander.rb 12 def multiplelines_receiver2(con) 13 ret = [] 14 while select [con], nil, nil, 0.05 15 ret << con.gets.chomp 16 end 17 ret 18 end
send_cmd(cmd, nid = nil)
click to toggle source
# File lib/roma/tools/multi_commander.rb 26 def send_cmd(cmd, nid = nil) 27 nid = @rd.nodes[0] unless nid 28 res = '' 29 res << @sender.send_command(nid, cmd, nil, :multiplelines_receiver2).join("\r\n") 30 res << "\r\n" 31 end
send_cmd_all(cmd)
click to toggle source
# File lib/roma/tools/multi_commander.rb 33 def send_cmd_all(cmd) 34 res = '' 35 @rd.nodes.each{|nid| 36 res << "****** #{nid}\r\n" 37 res << send_cmd(cmd, nid) 38 } 39 res 40 end