Sha256: 8fa75a9e6e1a60b6215a28c7efbe8ea6827a02d2f60cde08d98b93ccd729cb21

Contents?: true

Size: 1.22 KB

Versions: 4

Compression:

Stored size: 1.22 KB

Contents

module Actions
  module Pulp3
    module CapsuleContent
      class RefreshDistribution < Pulp3::AbstractAsyncTask
        include Helpers::Presenter
        middleware.use Actions::Middleware::ExecuteIfContentsChanged

        def plan(repository, smart_proxy, options = {})
          plan_self(:repository_id => repository.id,
                             :smart_proxy_id => smart_proxy.id,
                             :options => options)
        end

        def run
          smart_proxy = ::SmartProxy.unscoped.find(input[:smart_proxy_id])
          options = input[:options]
          tasks = options[:tasks]
          repo = ::Katello::Repository.find(input[:repository_id])
          if options[:use_repository_version]
            output[:response] = repo.backend_service(smart_proxy).refresh_mirror_distributions(:use_repository_version => true)
          elsif tasks && tasks[:pulp_tasks] && tasks[:pulp_tasks].first
            publication_href = tasks[:pulp_tasks].first[:created_resources].first
            if publication_href
              output[:response] = repo.backend_service(smart_proxy).refresh_mirror_distributions(:publication => publication_href)
            end
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
katello-3.14.1 app/lib/actions/pulp3/capsule_content/refresh_distribution.rb
katello-3.14.0 app/lib/actions/pulp3/capsule_content/refresh_distribution.rb
katello-3.14.0.rc2 app/lib/actions/pulp3/capsule_content/refresh_distribution.rb
katello-3.14.0.rc1 app/lib/actions/pulp3/capsule_content/refresh_distribution.rb