app/lib/actions/pulp3/repository/reclaim_space.rb in katello-4.4.0.rc1 vs app/lib/actions/pulp3/repository/reclaim_space.rb in katello-4.4.0.rc2
- old
+ new
@@ -1,18 +1,11 @@
module Actions
module Pulp3
module Repository
class ReclaimSpace < Pulp3::AbstractAsyncTask
- def plan(repositories, smart_proxy = SmartProxy.pulp_primary)
- repositories = [repositories] if repositories.is_a?(::Katello::Repository)
- if repositories.empty?
- fail _("No repositories selected.")
- end
- repositories = repositories.select { |repo| repo.download_policy == ::Katello::RootRepository::DOWNLOAD_ON_DEMAND }
- if repositories.empty?
- fail _("Only On Demand repositories may have space reclaimed.")
- end
- repository_hrefs = ::Katello::Pulp3::RepositoryReference.default_cv_repository_hrefs(repositories, Organization.current)
+ def plan(repo, smart_proxy = SmartProxy.pulp_primary)
+ action_subject(repo)
+ repository_hrefs = ::Katello::Pulp3::RepositoryReference.default_cv_repository_hrefs([repo], Organization.current || repositories.first.organization)
plan_self(repository_hrefs: repository_hrefs, smart_proxy_id: smart_proxy.id)
end
def invoke_external_task
output[:pulp_tasks] = ::Katello::Pulp3::Api::Core.new(SmartProxy.find(input[:smart_proxy_id])).