Class: Actions::Pulp3::Repository::SavePublication

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

Instance Method Summary collapse

Methods inherited from Abstract

#smart_proxy

Instance Method Details

#plan(repository, tasks, options = {}) ⇒ Object



6
7
8
# File 'app/lib/actions/pulp3/repository/save_publication.rb', line 6

def plan(repository, tasks, options = {})
  plan_self(:repository_id => repository.id, :tasks => tasks, :contents_changed => options[:contents_changed])
end

#runObject



10
11
12
13
14
15
16
17
18
19
20
# File 'app/lib/actions/pulp3/repository/save_publication.rb', line 10

def run
  if input[:tasks] && input[:tasks][:pulp_tasks] && input[:tasks][:pulp_tasks].first
    publication_href = input[:tasks][:pulp_tasks].first[:created_resources].first
    if publication_href
      repo = ::Katello::Repository.find(input[:repository_id])
      repo_backend_service = repo.backend_service(SmartProxy.pulp_primary)
      publication = repo_backend_service.api.publications_api.read(publication_href, {fields: 'prn'})
      repo.update(:publication_href => publication_href, :publication_prn => publication.prn)
    end
  end
end