app/lib/actions/katello/repository/update.rb in katello-2.4.5 vs app/lib/actions/katello/repository/update.rb in katello-3.0.0.rc1

- old
+ new

@@ -1,11 +1,15 @@ module Actions module Katello module Repository class Update < Actions::EntryAction + middleware.use Actions::Middleware::KeepCurrentUser + def plan(repository, repo_params) action_subject repository + repository = repository.reload + repo_params[:url] = nil if repo_params[:url] == '' repository.update_attributes!(repo_params) if update_content?(repository) plan_action(::Actions::Candlepin::Product::ContentUpdate, :content_id => repository.content_id, @@ -20,35 +24,16 @@ plan_action(::Actions::Pulp::Repository::Refresh, repository) end if SETTINGS[:katello][:use_pulp] && (repository.previous_changes.key?('unprotected') || repository.previous_changes.key?('checksum_type')) - plan_self(:user_id => ::User.current.id, :pulp_id => repository.pulp_id, - :distributor_type_id => distributor_type_id(repository.content_type)) + plan_self(:repository_id => repository.id) end end def run - ::User.current = ::User.find(input[:user_id]) - ForemanTasks.async_task(::Actions::Pulp::Repository::DistributorPublish, - :pulp_id => input[:pulp_id], - :distributor_type_id => input[:distributor_type_id]) - ensure - ::User.current = nil - end - - def distributor_type_id(content_type) - distributor = case content_type - when ::Katello::Repository::YUM_TYPE - Runcible::Models::YumDistributor - when ::Katello::Repository::PUPPET_TYPE - Runcible::Models::PuppetInstallDistributor - when ::Katello::Repository::FILE_TYPE - Runcible::Models::IsoDistributor - when ::Katello::Repository::DOCKER_TYPE - Runcible::Models::DockerDistributor - end - distributor.type_id + repository = ::Katello::Repository.find(input[:repository_id]) + ForemanTasks.async_task(Katello::Repository::MetadataGenerate, repository) end private def update_content?(repository)