[Title] save port information and etc to db
authorjiil.hyoun <jiil.hyoun@samsung.com>
Thu, 6 Dec 2012 02:51:57 +0000 (11:51 +0900)
committerjiil.hyoun <jiil.hyoun@samsung.com>
Thu, 6 Dec 2012 02:51:57 +0000 (11:51 +0900)
[Type] Feature
[Module] Toolchain /
[Priority] Minor
[Jira#]
[Redmine#]
[Problem]
[Cause]
[Solution]
[TestCase]

Change-Id: Ic2c9bdf8696c8035afd85f107a7b3e9e76c8bc39

src/build_server/BuildServer.rb

index cc903db15ab03d4b7d2769303ce8e1e59fc07bdd..fd5e28d38713178fba89da1dbdf87c25a833c532 100644 (file)
@@ -196,8 +196,14 @@ class BuildServer
                return (@db_dsn =~ /^Mysql/i) ? "NOW()" : "datetime('now')"
        end
 
+       def save_port
+               get_db_connection() do |db|
+                       db.do "UPDATE server_configs SET value = '#{@port}' WHERE property = 'port'"
+               end
+       end
        # start server daemon
        def start
+               save_port
                # set build cache dir
                @build_cache_dir="#{BuildServer::CONFIG_ROOT}/#{@id}/build_cache"
                if not File.exist? @build_cache_dir then
@@ -611,7 +617,10 @@ class BuildServer
 
                        # create table
                        db.do "CREATE TABLE server_configs ( id INTEGER PRIMARY KEY #{inc}, property VARCHAR(64) NOT NULL, value VARCHAR(256) )#{post_fix}"
+                       db.do "INSERT INTO server_configs (property,value) VALUES ('id','#{@id}')"
+                       db.do "INSERT INTO server_configs (property,value) VALUES ('path','#{@path}')"
                        db.do "INSERT INTO server_configs (property,value) VALUES ('db_version','#{@db_version}')"
+                       db.do "INSERT INTO server_configs (property,value) VALUES ('port','#{@port}')"
                        db.do "INSERT INTO server_configs (property,value) VALUES ('max_working_jobs','2')"
                        db.do "INSERT INTO server_configs (property,value) VALUES ('send_mail','NO')"
                        db.do "INSERT INTO server_configs (property,value) VALUES ('keep_time','86400')"