Sha256: 56f3609980cfdb1d14e051a5498c24ec1e90ace8b0fc62a9efd38ffd1abf6be2

Contents?: true

Size: 1.33 KB

Versions: 10

Compression:

Stored size: 1.33 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 invoke_external_task
          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]
            repo.backend_service(smart_proxy).with_mirror_adapter.refresh_distributions(:use_repository_version => true)
          elsif tasks && tasks[:pulp_tasks] && tasks[:pulp_tasks].first
            if (publication_href = ::Katello::Pulp3::Task.publication_href(tasks[:pulp_tasks]))
              repo.backend_service(smart_proxy).with_mirror_adapter.refresh_distributions(:publication => publication_href)
            else
              fail "Unable to refresh distribution for repo #{repository.id}, could not find a publication_href"
            end
          end
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
katello-4.2.1 app/lib/actions/pulp3/capsule_content/refresh_distribution.rb
katello-4.2.0.1 app/lib/actions/pulp3/capsule_content/refresh_distribution.rb
katello-4.1.4 app/lib/actions/pulp3/capsule_content/refresh_distribution.rb
katello-4.2.0.1.rc3 app/lib/actions/pulp3/capsule_content/refresh_distribution.rb
katello-4.2.0.1.rc2 app/lib/actions/pulp3/capsule_content/refresh_distribution.rb
katello-4.2.0.rc2 app/lib/actions/pulp3/capsule_content/refresh_distribution.rb
katello-4.1.3 app/lib/actions/pulp3/capsule_content/refresh_distribution.rb
katello-4.2.0.rc1 app/lib/actions/pulp3/capsule_content/refresh_distribution.rb
katello-4.1.2.1 app/lib/actions/pulp3/capsule_content/refresh_distribution.rb
katello-4.1.2 app/lib/actions/pulp3/capsule_content/refresh_distribution.rb