Sha256: 0a842654651810bf1cb28f1be9e4dceb9599203583df69bbd64ca6a4ebc56369

Contents?: true

Size: 1.67 KB

Versions: 30

Compression:

Stored size: 1.67 KB

Contents

module Actions
  module Pulp
    module Repository
      class DistributorPublish < Pulp::AbstractAsyncTask
        middleware.use Actions::Middleware::SkipIfMatchingContent

        input_format do
          param :pulp_id
          param :distributor_type_id
          param :source_pulp_id
          param :dependency
          param :override_config
          param :matching_content
        end

        def invoke_external_task
          pulp_extensions.repository.
              publish(input[:pulp_id],
                      distributor_id(input[:pulp_id], input[:distributor_type_id]),
                      distributor_config)
        end

        def distributor_id(pulp_id, distributor_type_id)
          distributor = repo(pulp_id)["distributors"].find do |dist|
            dist["distributor_type_id"] == distributor_type_id
          end
          distributor['id']
        end

        def distributor_config
          # the check for YumCloneDistributor is here for backwards compatibility
          if input[:distributor_type_id] == Runcible::Models::YumCloneDistributor.type_id
            { override_config: { source_repo_id: input[:source_pulp_id],
                                 source_distributor_id: source_distributor_id} }
          else
            { override_config: input[:override_config] }
          end
        end

        def source_distributor_id
          distributor_id(input[:source_pulp_id], Runcible::Models::YumDistributor.type_id)
        end

        def repo(pulp_id)
          pulp_extensions.repository.retrieve_with_details(pulp_id)
        end

        def humanized_name
          _("Repository metadata publish")
        end
      end
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
katello-3.8.1 app/lib/actions/pulp/repository/distributor_publish.rb
katello-3.7.1.1 app/lib/actions/pulp/repository/distributor_publish.rb
katello-3.7.1 app/lib/actions/pulp/repository/distributor_publish.rb
katello-3.8.0 app/lib/actions/pulp/repository/distributor_publish.rb
katello-3.8.0.rc3 app/lib/actions/pulp/repository/distributor_publish.rb
katello-3.8.0.rc2 app/lib/actions/pulp/repository/distributor_publish.rb
katello-3.7.0 app/lib/actions/pulp/repository/distributor_publish.rb
katello-3.8.0.rc1 app/lib/actions/pulp/repository/distributor_publish.rb
katello-3.7.0.rc2 app/lib/actions/pulp/repository/distributor_publish.rb
katello-3.7.0.rc1 app/lib/actions/pulp/repository/distributor_publish.rb
katello-3.5.2 app/lib/actions/pulp/repository/distributor_publish.rb
katello-3.6.0 app/lib/actions/pulp/repository/distributor_publish.rb
katello-3.6.0.1.rc2 app/lib/actions/pulp/repository/distributor_publish.rb
katello-3.6.0.rc2 app/lib/actions/pulp/repository/distributor_publish.rb
katello-3.6.0.rc1 app/lib/actions/pulp/repository/distributor_publish.rb
katello-3.5.1.1 app/lib/actions/pulp/repository/distributor_publish.rb
katello-3.5.1 app/lib/actions/pulp/repository/distributor_publish.rb
katello-3.5.0.1 app/lib/actions/pulp/repository/distributor_publish.rb
katello-3.5.0 app/lib/actions/pulp/repository/distributor_publish.rb
katello-3.5.0.rc2 app/lib/actions/pulp/repository/distributor_publish.rb