Sha256: 07162b91278d58442c9549e8479aa3a0f21a3924571dfda21625f048d9eea146

Contents?: true

Size: 1.69 KB

Versions: 10

Compression:

Stored size: 1.69 KB

Contents

module Actions
  module Pulp3
    module CapsuleContent
      class GenerateMetadata < Pulp3::AbstractAsyncTask
        middleware.use Actions::Middleware::ExecuteIfContentsChanged
        def plan(repository, smart_proxy, options = {})
          options[:contents_changed] = (options && options.key?(:contents_changed)) ? options[:contents_changed] : true
          sequence do
            if !::Katello::RepositoryTypeManager.find(repository.content_type).pulp3_skip_publication
              action_output = plan_self(:repository_id => repository.id, :smart_proxy_id => smart_proxy.id,
                                 :options => options).output
              plan_action(RefreshDistribution, repository, smart_proxy,
                            :tasks => action_output,
                            :use_repository_version => false,
                            :contents_changed => options[:contents_changed])
            else
              plan_action(RefreshDistribution, repository, smart_proxy,
                            :use_repository_version => true,
                            :contents_changed => options[:contents_changed])
            end
          end
        end

        def invoke_external_task
          if input[:options][:sync_task_output] &&
              ::Katello::Pulp3::Task.publication_href(input[:options][:sync_task_output]).present?
            return input[:options][:sync_task_output]
          end

          repository = ::Katello::Repository.find(input[:repository_id])
          smart_proxy = ::SmartProxy.unscoped.find(input[:smart_proxy_id])
          output[:response] = repository.backend_service(smart_proxy).with_mirror_adapter.create_publication
        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/generate_metadata.rb
katello-4.2.0.1 app/lib/actions/pulp3/capsule_content/generate_metadata.rb
katello-4.1.4 app/lib/actions/pulp3/capsule_content/generate_metadata.rb
katello-4.2.0.1.rc3 app/lib/actions/pulp3/capsule_content/generate_metadata.rb
katello-4.2.0.1.rc2 app/lib/actions/pulp3/capsule_content/generate_metadata.rb
katello-4.2.0.rc2 app/lib/actions/pulp3/capsule_content/generate_metadata.rb
katello-4.1.3 app/lib/actions/pulp3/capsule_content/generate_metadata.rb
katello-4.2.0.rc1 app/lib/actions/pulp3/capsule_content/generate_metadata.rb
katello-4.1.2.1 app/lib/actions/pulp3/capsule_content/generate_metadata.rb
katello-4.1.2 app/lib/actions/pulp3/capsule_content/generate_metadata.rb