[Title] Fixed a bug that upgrade of sub servers are not working
authordonghee yang <donghee.yang@samsung.com>
Tue, 16 Oct 2012 13:13:08 +0000 (22:13 +0900)
committerdonghee yang <donghee.yang@samsung.com>
Tue, 16 Oct 2012 13:13:08 +0000 (22:13 +0900)
package/changelog
package/pkginfo.manifest
upgrade

index 0328c0de9df9f849036e7cfe4d5eb5ff8c7ed296..06f56a0845c9feea5fbb752c22474b4ce26170e0 100644 (file)
@@ -1,3 +1,6 @@
+* 1.2.4
+- Fixed a bug that "upgrade" of sub servers are not done
+== hyoun jiil <jiil.hyoun@samsung.com> 2011-10-16
 * 1.2.3
 - Set "wget" retry count to 3
 == hyoun jiil <jiil.hyoun@samsung.com> 2011-10-16
index 80ed80cd79e9ead8babe092b4e0696884b36ca5b..836ef854a475154b1e14bf98b8fa30d9ebe85cbf 100644 (file)
@@ -1,5 +1,5 @@
 Source : dibs
-Version :1.2.3
+Version :1.2.4
 Maintainer : taejun ha<taejun.ha@samsung.com>, jiil hyoun <jiil.hyoun@samsung.com>, donghyuk yang <donghyouk.yang@samsung.com>, donghee yang <donghee.yang@samsung.com>, sungmin kim <dev.sungmin.kim@samsung.com
 
 Package : dibs
diff --git a/upgrade b/upgrade
index 75b383fa494a51a0700bfb20015cb987e400827f..1ecae037ec2275ac57d5467192f76e1977cd2f8f 100755 (executable)
--- a/upgrade
+++ b/upgrade
@@ -129,7 +129,6 @@ begin
        NEW_VER_PATH = BACKUP_ROOT + "/new_ver"
        UPGRADE_CMD = "#{PREV_VER_PATH}/upgrade"
        BUILD_CONFIG_ROOT = "#{Utils::HOME}/.build_tools/build_server/#{svr_name}"
-       BUILD_FRIENDS_FILE = "#{BUILD_CONFIG_ROOT}/friends"
 
        if not File.exist? BACKUP_ROOT then FileUtils.mkdir_p(BACKUP_ROOT) end
        log = PackageServerLog.new( "#{BACKUP_ROOT}/log" )
@@ -191,50 +190,34 @@ begin
 
                # Execute start command
                if start_opt 
-                       if svr_type.eql? "BUILDSERVER" then
+                       if not build_server.nil? and svr_type.eql? "BUILDSERVER" then
                                # get friends server information
-                               if File.exist? BUILD_FRIENDS_FILE then
-                                       File.open( BUILD_FRIENDS_FILE, "r" ) do |f|
-                                               f.each_line do |l|
-                                                       if l.split(",").count < 2 then 
-                                                               next 
-                                                       end
-
-                                                       ip = l.split(",")[0].strip
-                                                       port = l.split(",")[1].strip
-                       
-                                                       build_client = BuildCommClient.create( ip, port )
-                                                       if build_client.nil? then
-                                                               log.info("Friend Server #{ip}:#{port} is not running!", Log::LV_USER)
-                                                               next    
-                                                       end
+                               build_server.friend_servers.each do |svr|
+                                       ip = svr.ip
+                                       port = svr.port
+       
+                                       build_client = BuildCommClient.create( ip, port )
+                                       if build_client.nil? then
+                                               log.info("Friend Server #{ip}:#{port} is not running!", Log::LV_USER)
+                                               next    
+                                       end
 
-                                                       # send request
-                                                       if build_client.send "UPGRADE|#{build_server.password}" then
-                                                               # recevie & print
-                                                               mismatched = false
-                                                               result = build_client.read_lines do |l|
-                                                                       log.error(l, Log::LV_USER)
-                                                                       if l.include? "Password mismatched!" then
-                                                                               mismatched = true
-                                                                       end
-                                                               end
-=begin
-                                                               if result and not mismatched then
-                                                                       log.info("Friend Server #{ip}:#{port} upgrade failed!", Log::LV_USER)
-                                                               else
-                                                                       log.info("Friend Server #{ip}:#{port} upgrade requested!", Log::LV_USER)
-                                                               end
-=end
+                                       # send request
+                                       log.info("Upgrading Friend Server #{ip}:#{port}...", Log::LV_USER)
+                                       if build_client.send "UPGRADE|#{build_server.password}" then
+                                               # recevie & print
+                                               mismatched = false
+                                               result = build_client.read_lines do |l|
+                                                       log.error(l, Log::LV_USER)
+                                                       if l.include? "Password mismatched!" then
+                                                               mismatched = true
                                                        end
-                       
-                                                       # terminate     
-                                                       build_client.terminate
                                                end
                                        end
-                               else
-                                       log.info("No Friend Server.", Log::LV_USER)
-                               end             
+       
+                                       # terminate     
+                                       build_client.terminate
+                               end
 
                                # Start Build server
                                cmd = Utils.generate_shell_command("#{dibs_path}/build-svr start -n #{svr_name} -p #{svr_port}")