Class: Actions::Pulp3::Repository::SaveDistributionReferences
- Inherits:
-
Abstract
- Object
- EntryAction
- Abstract
- Actions::Pulp3::Repository::SaveDistributionReferences
- Defined in:
- app/lib/actions/pulp3/repository/save_distribution_references.rb
Instance Method Summary collapse
Methods inherited from Abstract
Instance Method Details
#plan(repository, smart_proxy, tasks, options = {}) ⇒ Object
5 6 7 |
# File 'app/lib/actions/pulp3/repository/save_distribution_references.rb', line 5 def plan(repository, smart_proxy, tasks, = {}) plan_self(repository_id: repository.id, smart_proxy_id: smart_proxy.id, tasks: tasks, contents_changed: [:contents_changed]) end |
#run ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/lib/actions/pulp3/repository/save_distribution_references.rb', line 9 def run if input[:tasks] && input[:tasks][:pulp_tasks] && input[:tasks][:pulp_tasks].first distribution_hrefs = input[:tasks][:pulp_tasks].map { |task| task[:created_resources].first } distribution_hrefs.compact! repo = ::Katello::Repository.find(input[:repository_id]) if distribution_hrefs.any? repo.backend_service(smart_proxy).save_distribution_references(distribution_hrefs) else repo.backend_service(smart_proxy).update_distribution end end end |