[Title] packageServer -> sync command check parent server and error
authorhataejun <taejun.ha@samsung.com>
Thu, 10 Jan 2013 01:54:50 +0000 (10:54 +0900)
committerhataejun <taejun.ha@samsung.com>
Thu, 10 Jan 2013 01:54:50 +0000 (10:54 +0900)
return
[Type]
[Module]
[Priority]
[Jira#]
[Redmine#]
[Problem]
[Cause]
[Solution]
[TestCase]

src/pkg_server/distribution.rb
src/pkg_server/packageServer.rb

index e64816d3eb05c8b6b15ba60e36183f2ea3225c4a..5aa613b129fb992961d473044546ec4d328cb014 100644 (file)
@@ -205,8 +205,9 @@ class Distribution
 
                # check distribution's server_url
                if @server_url.empty? then
-                       @log.error("This distribution has not remote server", Log::LV_USER)
-                       return false
+                       @log.error("This distribution has not remote server")
+                       Utils.file_unlock(sync_lock_file)
+                       raise RuntimeError, "remote server address empty"
                end
 
                # generate client class
@@ -217,6 +218,15 @@ class Distribution
                end
                client = Client.new( server_url, "#{@location}/binary", @log )
 
+               # parents package server check
+               if client.pkg_hash_os.keys.empty? then
+                       @log.error("Sync process stopped by error.")
+                       @log.error("Parents package server does not have [[os_info]] file.")
+               
+                       Utils.file_unlock(sync_lock_file)
+                       raise RuntimeError, "Parents package server does not have [[os_info]] file."
+               end
+
                # update os list
                add_os_list = client.support_os_list - @support_os_list
                add_os_list.each do |os|
@@ -238,7 +248,7 @@ class Distribution
                @support_os_list.each do |os|
                        # error check
                        if client.pkg_hash_os[os].nil? then
-                               @log.error("package server does not have os : #{os}", Log::LV_USER)
+                               @log.error("os[[#{os}]] is removed in parents package server", Log::LV_USER)
                                next
                        end
 
index 120c0fd259d527282106f975b735bed12040e290..e4902750d04864c689cf3426c98bab14849159e7 100644 (file)
@@ -298,12 +298,17 @@ class PackageServer
                        return
                end
 
-               ret = distribution.sync(mode, snapshot)
-               if ret then
-                       distribution.generate_snapshot("", "", false, distribution.last_sync_changes)
-               end
+               begin
+                       ret = distribution.sync(mode, snapshot)
 
-               @log.output( "package server [#{@id}]'s distribution [#{dist_name}] has been synchronized.", Log::LV_USER )
+                       if ret then
+                               distribution.generate_snapshot("", "", false, distribution.last_sync_changes)
+                       end
+    
+                       @log.output( "package server [#{@id}]'s distribution [#{dist_name}] has been synchronized.", Log::LV_USER )
+               rescue => e
+                       @log.error( e.message, Log::LV_USER)
+               end
        end
 
        def add_distribution( dist_name, server_url, clone )