Class: Actions::Pulp3::Repository::SaveDistributionReferences

Inherits:
Abstract
  • Object
show all
Defined in:
app/lib/actions/pulp3/repository/save_distribution_references.rb

Instance Method Summary collapse

Methods inherited from Abstract

#smart_proxy

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, options = {})
  plan_self(repository_id: repository.id, smart_proxy_id: smart_proxy.id, tasks: tasks, contents_changed: options[:contents_changed])
end

#runObject



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