[title] Fixed cancel job about "Multi build" password
authorSungmin kim <dev.sungmin.kim@samsung.com>
Mon, 15 Apr 2013 08:07:04 +0000 (17:07 +0900)
committerSungmin kim <dev.sungmin.kim@samsung.com>
Mon, 15 Apr 2013 08:07:04 +0000 (17:07 +0900)
dibs-web/app/controllers/jobs_controller.rb
dibs-web/app/controllers/utils.rb
dibs-web/public/javascripts/log.js

index 37b936e4de6ecea44b29036b4d47a58e38ed879b..0172bb6e9b4174e36b0ed175a672c0b400621877 100644 (file)
@@ -630,13 +630,37 @@ class JobsController < ApplicationController
                        end
                end
 
+               # get password when Multi build
+               if job.job_type.eql? "MULTIBUILD"
+                       sub_job = Job.find(:first, :conditions => ["parent_job_id=?", id])
+                       sub_job_project_info = Project.find(sub_job.project_id)
+                       job_password = sub_job_project_info.password
+               else
+                       job_password = job.project_password
+               end
+
                # Excute command
+               message = ""
                begin
-                       Utils.sbi_cancel_command(id, job.project_password)
+                       result, message = Utils.sbi_cancel_command(id, job_password)
                rescue => e
                        render :text => e.message, :status => 406
-                       return
                end
-               render :xml=> "<Message>OK</Message>"
+
+               #generate to XML
+               doc = Builder::XmlMarkup.new( :target => out_string = "", :indent => 2 )
+               doc.Responser {
+                       generate_xml_header(doc)
+                       doc.Data {
+                               doc.JobId(id)
+                               doc.Distribution(job.distribution_name)
+                               doc.Project(job.project_name)
+                               doc.Builder(job.user_name)
+                               doc.Status(job.status)
+                               doc.Message(message)
+                       }
+               }
+
+               render :text => out_string, :content_type => "text/xml"
        end
 end
index d6b9ba413b679a69116840f5169a3b6da1e3265b..d4a5d2c0c5f690e30dc5f9f1f5bdb6529fc2b1d8 100644 (file)
@@ -108,7 +108,8 @@ puts "[[[#{cmd}]]]"
        cmd = "#{DIBS_PATH}/build-cli cancel #{options}"
 puts "Cancel command"
 puts "[[[#{cmd}]]]"
-       return execute_shell_return(cmd)
+       result, msg = execute_shell_return(cmd)
+       return result, msg
   end
 
   def Utils.sbi_fullbuild_command(server_name, dist_name)
index b5f067703ff6bc66b780030950b7f0b9871081d7..de72f9be75b216dab69626dd4668ab5b15ccd49c 100644 (file)
@@ -149,7 +149,8 @@ function moreLog() {
 
 function cancelJob() {
        cancelJobsJobid(job_id, function(xml) {
-               alert("Reqeusted cancel job : "+job_id);
+               var message = $(xml).find("Data").find("Message").text();
+               alert(message);
        });
 }