result = false
end
+ if not server.has_db? then
+ client = BuildCommClient.create( "127.0.0.1", server.port )
+ if not client.nil? then
+ # send request
+ if client.send "SET|#{attr}|#{value}" then
+ result = client.read_lines
+ end
+ # terminate
+ client.terminate
+ end
+ end
+
if result then write_server_config( server ) end
return result
"ERR021" => "No DB exists and create(migrate) DB first!",
"ERR022" => "There already exists same job.",
"ERR023" => "Cannot create package client!",
+ "ERR024" => "Attribute not supports!",
"ERR100" => "Package info file(\"package/pkginfo.manifest\") does not exist!",
"ERR101" => "Parsing package info file failed!",
handle_cmd_build( req_line, req )
when "QUERY"
handle_cmd_query( req_line, req )
+ when "SET"
+ handle_cmd_set( req_line,req )
when "CANCEL"
handle_cmd_cancel( req_line, req )
when "STOP"
end
end
+ # "SET"
+ def handle_cmd_set( line, req )
+ begin
+ handle_cmd_set_internal( line, req )
+ rescue BuildServerException => e
+ @log.error(e.message)
+ BuildCommServer.send(req, e.err_message())
+ ensure
+ BuildCommServer.send_end(req)
+ BuildCommServer.disconnect(req)
+ end
+ end
+
+ def handle_cmd_set_internal( line, req )
+ tok = line.split("|").map { |x| x.strip }
+ if tok.count < 3 then
+ raise BuildServerException.new("ERR001"), line
+ end
+ attr = tok[1]
+ value = tok[2]
+ case tok[1]
+ when "MAX_WORKING_JOBS"
+ BuildCommServer.send(req, "OK")
+ @parent_server.jobmgr.max_working_jobs = value.to_i
+ else
+ raise BuildServerException.new("ERR024"), line
+ end
+ end
# "CANCEL"
def handle_cmd_cancel( line, req )
ATTEMPTS = ["first", "second", "third"]
class BuildCommServer
- VERSION = "1.9.0"
+ VERSION = "1.9.1"
private_class_method :new
class BuildCommClient
- VERSION = "1.9.0"
+ VERSION = "1.9.1"
FIRST_RESPONSE_TIMEOUT = 120
private_class_method :new