[Title] package server list command lock/unlock and remove log file
authorhataejun <taejun.ha@samsung.com>
Wed, 22 Aug 2012 14:59:37 +0000 (23:59 +0900)
committerhataejun <taejun.ha@samsung.com>
Wed, 22 Aug 2012 14:59:37 +0000 (23:59 +0900)
[Type]
[Module]
[Priority]
[Jira#]
[Redmine#]
[Problem]
[Cause]
[Solution]
[TestCase]

src/pkg_server/packageServer.rb

index 2a675dbf1b8229be982014d9404662c28b0342c1..cc7813c15965f93d930c996427e4bec80a3abf4d 100644 (file)
@@ -507,7 +507,8 @@ class PackageServer
        end 
 
        def self.list_id  
-               @@log = PackageServerLog.new( "#{SERVER_ROOT}/.log" ) 
+               lock_file = Utils.file_lock(LOCK_FILE)
+               @@log = PackageServerLog.new("#{SERVER_ROOT}/.log") 
 
                d = Dir.new( SERVER_ROOT )
                s = d.select {|f| not f.start_with?(".") }  
@@ -519,9 +520,13 @@ class PackageServer
 
                        @@log.output( id, Log::LV_USER)
                end 
+               @@log.close
+               FileUtils.rm_rf("#{SERVER_ROOT}/.log")
+               Utils.file_unlock(lock_file)
        end
 
        def self.list_dist( id )
+               lock_file = Utils.file_lock(LOCK_FILE)
                @@log = PackageServerLog.new( "#{SERVER_ROOT}/.log" ) 
                
                @@log.output( "=== ID [#{id}]'s distribution list ===", Log::LV_USER)
@@ -539,6 +544,9 @@ class PackageServer
                                end
                        end
                end
+               @@log.close
+               FileUtils.rm_rf("#{SERVER_ROOT}/.log")
+               Utils.file_unlock(lock_file)
        end
 
        def get_default_dist_name()