Masato Taruishi
taru****@users*****
2004年 9月 9日 (木) 23:55:09 JST
=================================================================== RCS file: demo/haviewer/haviewer.rb,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- demo/haviewer/haviewer.rb 2004/09/09 12:36:52 1.21 +++ demo/haviewer/haviewer.rb 2004/09/09 14:55:09 1.22 @@ -176,16 +176,36 @@ Column.size.times do |i| @columns << Gtk::TreeViewColumn.new(Column[i], Gtk::CellRendererText.new, { :markup => i }) end - @row = {} -# h = Host.new(`ultrapossum-config get MASTER`.gsub!(/MASTER="(.+)"\n/, '\1'), "master" ) -# @row[h] =****@list***** -# Hosts << h - backup = `ultrapossum-config get BACKUP`.gsub!(/BACKUP="(.+)"\n/, '\1') - `ultrapossum-config get SLAVES`.gsub!(/SLAVES="(.*)"\n/, '\1').split(' ').each do |s| - h = Host.new(s.chomp, "master" ) # (backup==s)?"master":"slave" ) - @row[h] =****@list***** - Hosts << h - end + @row = {} + hash = {} + `ultrapossum-config get MASTER BACKUP SYNCBACKUPS`.each_line do |line| + host = nil + case line + when /(MASTER|BACKUP|SYNCBACKUPS)="(.+)"\n/ + $2.split(' ').each do |s| + host = Host.new(s,"master") + if hash[s].nil? + @row[host] =****@list***** + Hosts << host + hash[s] = host + end + end + end + end + `ultrapossum-config get SLAVES`.each_line do |line| + host = nil + case line + when /SLAVES="(.+)"\n/ + $1.split(' ').each do |s| + host = Host.new(s,"slave") + if hash[s].nil? + @row[host] =****@list***** + Hosts << host + hash[s] = host + end + end + end + end @master_icon = Signal::SignalFactory.create @slave_icon = Signal::SignalFactory.create columns.each do |val| @@ -246,11 +266,11 @@ class UltraPossumTest < View - Column = ["S", "Host", "Type", "Status" ] + Column = ["S", "Host", "Type", "Status", "entryCSN" ] def initialize(haview) super - @list = Gtk::ListStore.new( String, String, String, String ) + @list = Gtk::ListStore.new( String, String, String, String, String ) @columns = [] Column.size.times do |i| @columns << Gtk::TreeViewColumn.new(Column[i], Gtk::CellRendererText.new, { :markup => i })