diff --git a/app/models/build_list.rb b/app/models/build_list.rb index 2fb4c8fae..0be5ce693 100644 --- a/app/models/build_list.rb +++ b/app/models/build_list.rb @@ -267,16 +267,27 @@ class BuildList < ActiveRecord::Base def publish_container type = save_to_platform.distrib_type archive = results.select{ |r| r['file_name'] =~ /.*\.tar\.gz$/}[0] + + platform_path = "#{APP_CONFIG[root]}/platforms/#{save_to_platform.name}" + if save_to_platform.personal? + platform_path << '/' + platform_path << build_for_platform.name + Dir.mkdir(platform_path) unless File.exists?(platform_path) + end + Resque.push( "publish_build_list_container_#{type}_worker", 'class' => "AbfWorker::PublishBuildListContainer#{type.capitalize}Worker", 'args' => [{ :id => id, - :released => save_to_platform.released, :arch => arch.name, :distrib_type => type, :container_sha1 => archive['sha1'], - :platform_path => "#{APP_CONFIG[root]}/platforms/#{save_to_platform.name}/", + :platform => { + :platform_path => platform_path, + :released => save_to_platform.released + }, + :repository_name => save_to_repository.name, :time_living => 1800 # 30 min }] ) diff --git a/lib/abf_worker/iso_worker_observer.rb b/lib/abf_worker/iso_worker_observer.rb index 0bfd5aebd..93eca869a 100644 --- a/lib/abf_worker/iso_worker_observer.rb +++ b/lib/abf_worker/iso_worker_observer.rb @@ -17,8 +17,7 @@ module AbfWorker pbl.build_canceled end if status != BUILD_STARTED - pbl.results = options['results'] - pbl.save! + update_results(pbl, options) end end diff --git a/lib/abf_worker/observer_helper.rb b/lib/abf_worker/observer_helper.rb index 31ac8554a..994586a34 100644 --- a/lib/abf_worker/observer_helper.rb +++ b/lib/abf_worker/observer_helper.rb @@ -5,5 +5,12 @@ module AbfWorker BUILD_PENDING = 2 BUILD_STARTED = 3 BUILD_CANCELED = 4 + + def update_results(subject, options) + results = (subject.results || [])+ options['results'] + subject.results = results.sort_by{ |r| r['file_name'] } + subject.save! + end + end end \ No newline at end of file diff --git a/lib/abf_worker/publish_build_list_container_observer.rb b/lib/abf_worker/publish_build_list_container_observer.rb index 6fc70272f..cbc6d509e 100644 --- a/lib/abf_worker/publish_build_list_container_observer.rb +++ b/lib/abf_worker/publish_build_list_container_observer.rb @@ -19,16 +19,5 @@ module AbfWorker end end - class << self - protected - - def update_results(bl, options) - results = bl.results + options['results'] - bl.results = results.sort_by{ |r| r['file_name'] } - bl.save! - end - - end - end end \ No newline at end of file diff --git a/lib/abf_worker/rpm_worker_observer.rb b/lib/abf_worker/rpm_worker_observer.rb index 8981c4d11..b468d676c 100644 --- a/lib/abf_worker/rpm_worker_observer.rb +++ b/lib/abf_worker/rpm_worker_observer.rb @@ -52,9 +52,11 @@ module AbfWorker container = (options['results'] || []). select{ |r| r['file_name'] !~ /.*\.log$/ }.first sha1 = container ? container['sha1'] : nil - bl.results = options['results'] - bl.container_path = "#{APP_CONFIG['file_store_url']}/#{sha1}" if sha1 - bl.save! + if sha1 + bl.container_path = "#{APP_CONFIG['file_store_url']}/#{sha1}" + bl.save! + end + update_results(bl, options) end end