[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Debian JP master SVN www commits (rev.278)



=======================================================
Repository: /org/svn.debian.or.jp/repos
  Revision: 278
  Commiter: yasu
      Date: 2007-05-01 14:11:44 +0900 (火, 01  5月 2007)
=======================================================
Log:

New feature: Added /debian/project/trace/hostname file time check.



=======================================================
Changed:

U   cdn/ChangeLog
U   cdn/README
U   cdn/check-surrogates.rb
U   cdn/lists_deb_cdn_araki_net.rb
U   cdn/lists_jp_cdn_araki_net.rb

Modified: cdn/ChangeLog
===================================================================
--- cdn/ChangeLog	2007-05-01 01:52:19 UTC (rev 277)
+++ cdn/ChangeLog	2007-05-01 05:11:44 UTC (rev 278)
@@ -1,3 +1,11 @@
+2007-05-01  ARAKI Yasuhiro  <yasu@debian.or.jp>
+
+	** New feature: Added /debian/project/trace/hostname file time check.
+	* check-surrogates.rb (CheckSurrogate::checkhttp): apply for this change.
+	* lists_jp_cdn_araki_net.rb: apply for this change.
+	* lists_deb_cdn_araki_net.rb: apply for this change.
+	* README: apply for this change.
+
 2007-04-28  ARAKI Yasuhiro  <yasu@debian.or.jp>
 
 	** New feature: it can resolve multiple hostnames.

Modified: cdn/README
===================================================================
--- cdn/README	2007-05-01 01:52:19 UTC (rev 277)
+++ cdn/README	2007-05-01 05:11:44 UTC (rev 278)
@@ -31,3 +31,31 @@
 
 などのような出力が出ていれば問題ない。
 
+-----
+リストファイルの文法について
+
+リストファイルには、3つの変数を設定する必要がある。
+
+- サロゲートIPアドレスと優先度は $surrogates に。
+
+優先度は0から9999までの整数。指定方法は以下のようにする。
+
+$surrogates = {
+  '203.178.137.175' => '9000', # naist
+  '61.115.118.67' => '20', # hanzubon 2007apr5
+}
+
+- 最上流のrsyncサーバのIPアドレスを $first_surrogate に。
+- 最上流のrsyncサーバで使用しているrsync終了のサインとなるファイル名を $tracefile に。
+
+例えば、
+http://hanzubon.jp/ (61.115.118.67) を最上流に設定し、このときの
+ファイルが
+http://hanzubon.jp/debian/project/trace/air.hanzubon.jp
+ならば、
+
+$tracefile = 'air.hanzubon.jp' # hanzubon 2007apr5
+$first_surrogate = '61.115.118.67'
+
+のようになる。
+

Modified: cdn/check-surrogates.rb
===================================================================
--- cdn/check-surrogates.rb	2007-05-01 01:52:19 UTC (rev 277)
+++ cdn/check-surrogates.rb	2007-05-01 05:11:44 UTC (rev 278)
@@ -7,6 +7,7 @@
 require 'uri'
 require 'resolv'
 require 'find'
+require 'time'
 
 class CheckSurrogate
   attr :lines
@@ -17,17 +18,30 @@
                         Syslog::Constants::LOG_PID |
                         Syslog::Constants::LOG_CONS,
                         Syslog::Constants::LOG_DAEMON)
+    @last_modified = nil
   end
 
-  def checkhttp(host, codename='sid', port=80, tl=5)
+  def checkhttp(host, tracefile, first_surrogate=nil, port=80)
     begin 
       h = Net::HTTP.new(host, port)
       h.open_timeout = 8 
       h.read_timeout = 8
-      case response = h.head("/debian/dists/#{codename}/Release", nil)
+      case response = h.head("/debian/project/trace/#{tracefile}", nil)
       when Net::HTTPSuccess
-        @slog.info("#{host} return #{response.code}")
-        return true
+        if first_surrogate
+          @last_modified = Time.parse(response['last-modified'])
+          @slog.info("#{host} return #{response.code} #{@last_modified} set")
+          return true
+        elsif @last_modified && @last_modified == Time.parse(response['last-modified'])
+          @slog.info("#{host} return #{response.code} #{@last_modified} equal")
+          return true
+        elsif @last_modified && @last_modified != Time.parse(response['last-modified'])
+          @slog.info("#{host} return #{response.code} #{response['last-modified']} differnet timestamp. Igonore this host.")
+          return nil
+        else
+          @slog.info("#{host} return #{response.code} (please set $first_surrogate")
+          return true
+        end
       else
         @slog.info("#{host} return #{response.code}")
         return nil
@@ -49,12 +63,21 @@
     domain.gsub!(/_/, '.')
 
     surrogates = ''
+    @last_modified = nil
+    $surrogates = ''
+    $tracefile = ''
+    $first_surrogate = ''
     require listfile
+
+    if $tracefile && $first_surrogate
+      checkhttp($first_surrogate, $tracefile, true)
+    end
+
     surrogates = $surrogates
 
     s_active = Hash.new
     surrogates.each do |t_ip, t_value|
-      if checkhttp(t_ip)
+      if checkhttp(t_ip, $tracefile)
         s_active[t_ip.gsub('.',',')] = t_value
       else
       end

Modified: cdn/lists_deb_cdn_araki_net.rb
===================================================================
--- cdn/lists_deb_cdn_araki_net.rb	2007-05-01 01:52:19 UTC (rev 277)
+++ cdn/lists_deb_cdn_araki_net.rb	2007-05-01 05:11:44 UTC (rev 278)
@@ -1,3 +1,6 @@
+$tracefile = 'air.hanzubon.jp' # hanzubon 2007apr5
+$first_surrogate = '61.115.118.67'
+
 $surrogates = {
   '203.178.137.175' => '9000', # naist
   '61.115.118.67' => '20', # hanzubon 2007apr5

Modified: cdn/lists_jp_cdn_araki_net.rb
===================================================================
--- cdn/lists_jp_cdn_araki_net.rb	2007-05-01 01:52:19 UTC (rev 277)
+++ cdn/lists_jp_cdn_araki_net.rb	2007-05-01 05:11:44 UTC (rev 278)
@@ -1,3 +1,6 @@
+$tracefile = 'air.hanzubon.jp' # hanzubon 2007apr5
+$first_surrogate = '61.115.118.67'
+
 $surrogates = {
   '203.178.137.175' => '9000', # naist
   '61.115.118.67' => '20', # hanzubon 2007apr5