From 677195b1164c187f5e728a92013bfc58d3e98514 Mon Sep 17 00:00:00 2001 From: Alexander Machehin Date: Tue, 12 Feb 2013 16:52:40 +0600 Subject: [PATCH] [refs #893] some fixes from comments --- app/controllers/platforms/repositories_controller.rb | 2 +- app/views/platforms/repositories/_form.html.haml | 5 +++-- lib/abf_worker/build_lists_publish_task_manager.rb | 7 ++++--- lib/abf_worker/publish_observer.rb | 9 ++++----- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/app/controllers/platforms/repositories_controller.rb b/app/controllers/platforms/repositories_controller.rb index 0091967f5..7e9d42ce4 100644 --- a/app/controllers/platforms/repositories_controller.rb +++ b/app/controllers/platforms/repositories_controller.rb @@ -141,7 +141,7 @@ class Platforms::RepositoriesController < Platforms::BaseController end def regenerate_metadata - AbfWorker::BuildListsPublishTaskManager.repository_regenerate_metadata @repository + AbfWorker::BuildListsPublishTaskManager.repository_regenerate_metadata @repository.id redirect_to platform_repository_path(@platform, @repository) end diff --git a/app/views/platforms/repositories/_form.html.haml b/app/views/platforms/repositories/_form.html.haml index 4c8011ffb..69c84c252 100644 --- a/app/views/platforms/repositories/_form.html.haml +++ b/app/views/platforms/repositories/_form.html.haml @@ -4,8 +4,9 @@ - else .leftlist .rightlist - = link_to t("layout.repositories.regenerate_metadata"), regenerate_metadata_platform_repository_path(@platform, @repository), - :method => :put, :confirm => t('layout.confirm'), :class => :button + -if can? :regenerate_metadata, @repository + = link_to t("layout.repositories.regenerate_metadata"), regenerate_metadata_platform_repository_path(@platform, @repository), + :method => :put, :confirm => t('layout.confirm'), :class => :button .leftlist= f.label :description, t("activerecord.attributes.repository.description"), :class => :label .rightlist= f.text_field :description, :class => 'text_field' diff --git a/lib/abf_worker/build_lists_publish_task_manager.rb b/lib/abf_worker/build_lists_publish_task_manager.rb index e164a77cf..5c549928d 100644 --- a/lib/abf_worker/build_lists_publish_task_manager.rb +++ b/lib/abf_worker/build_lists_publish_task_manager.rb @@ -319,14 +319,15 @@ module AbfWorker options = { :id => Time.now.to_i, - #:arch => nil, + :arch => 'x86_64', :distrib_type => distrib_type, :cmd_params => cmd_params, :platform => {:platform_path => platform_path}, :repository => {:id => rep.id}, - :type => :regenerate, + :type => :publish, :time_living => 9600, # 160 min - :lock_str => lock_str + :skip_feedback => true, + :extra => {:lock_str => lock_str, :regenerate => true} } Resque.push( diff --git a/lib/abf_worker/publish_observer.rb b/lib/abf_worker/publish_observer.rb index b3b72e010..e0cf779d9 100644 --- a/lib/abf_worker/publish_observer.rb +++ b/lib/abf_worker/publish_observer.rb @@ -9,13 +9,12 @@ module AbfWorker def perform return if status == STARTED # do nothing when publication started - case options['type'] - when 'resign' + if options['type'] == 'resign' AbfWorker::BuildListsPublishTaskManager.unlock_repository options['id'] - when 'regenerate' - AbfWorker::BuildListsPublishTaskManager.unlock_rep_and_platform nil, options['lock_str'] else - if options['extra']['create_container'] # Container has been created + if options['extra']['regenerate'] # Regenerate metadata + AbfWorker::BuildListsPublishTaskManager.unlock_rep_and_platform nil, options['lock_str'] + elsif options['extra']['create_container'] # Container has been created case status when COMPLETED subject.published_container