Sha256: cf7dead9e7db8347b44099043134e20f246fd7b908e09975ff8a99c8911d4665

Contents?: true

Size: 1.95 KB

Versions: 24

Compression:

Stored size: 1.95 KB

Contents

module Actions
  module Pulp3
    module Orchestration
      module Repository
        class GenerateMetadata < Pulp3::Abstract
          def plan(repository, smart_proxy, options = {})
            force_publication = options.fetch(:force_publication, repository.publication_href.nil?)

            options[:contents_changed] = (options && options.key?(:contents_changed)) ? options[:contents_changed] : true
            publication_content_type = !::Katello::RepositoryTypeManager.find(repository.content_type).pulp3_skip_publication

            sequence do
              if options[:source_repository] && publication_content_type
                plan_self(source_repository_id: options[:source_repository].id, target_repository_id: repository.id, smart_proxy_id: smart_proxy.id)
              elsif publication_content_type && (force_publication || repository.publication_href.nil? || !repository.using_mirrored_metadata?)
                plan_action(Actions::Pulp3::Repository::CreatePublication, repository, smart_proxy, options)
              end
              plan_action(Actions::Pulp3::ContentGuard::Refresh, smart_proxy) unless repository.unprotected
              plan_action(Actions::Pulp3::Repository::RefreshDistribution, repository, smart_proxy, :contents_changed => options[:contents_changed]) if Setting[:distribute_archived_cvv] || repository.environment
            end
          end

          def run
            #we don't have to actually generate a publication, we can reuse the old one
            target_repo = ::Katello::Repository.find(input[:target_repository_id])
            source_repo = ::Katello::Repository.find(input[:source_repository_id])
            if (target_repo.publication_href != source_repo.publication_href && smart_proxy.pulp_primary?)
              target_repo.clear_smart_proxy_sync_histories
            end
            target_repo.update!(publication_href: source_repo.publication_href)
          end
        end
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
katello-4.9.1 app/lib/actions/pulp3/orchestration/repository/generate_metadata.rb
katello-4.9.0 app/lib/actions/pulp3/orchestration/repository/generate_metadata.rb
katello-4.7.6 app/lib/actions/pulp3/orchestration/repository/generate_metadata.rb
katello-4.8.2 app/lib/actions/pulp3/orchestration/repository/generate_metadata.rb
katello-4.9.0.rc2 app/lib/actions/pulp3/orchestration/repository/generate_metadata.rb
katello-4.9.0.rc1 app/lib/actions/pulp3/orchestration/repository/generate_metadata.rb
katello-4.8.1 app/lib/actions/pulp3/orchestration/repository/generate_metadata.rb
katello-4.7.5 app/lib/actions/pulp3/orchestration/repository/generate_metadata.rb
katello-4.8.0 app/lib/actions/pulp3/orchestration/repository/generate_metadata.rb
katello-4.8.0.rc2 app/lib/actions/pulp3/orchestration/repository/generate_metadata.rb
katello-4.7.4 app/lib/actions/pulp3/orchestration/repository/generate_metadata.rb
katello-4.8.0.rc1 app/lib/actions/pulp3/orchestration/repository/generate_metadata.rb
katello-4.7.3 app/lib/actions/pulp3/orchestration/repository/generate_metadata.rb
katello-4.7.2 app/lib/actions/pulp3/orchestration/repository/generate_metadata.rb
katello-4.7.1 app/lib/actions/pulp3/orchestration/repository/generate_metadata.rb
katello-4.6.2.1 app/lib/actions/pulp3/orchestration/repository/generate_metadata.rb
katello-4.6.2 app/lib/actions/pulp3/orchestration/repository/generate_metadata.rb
katello-4.7.0 app/lib/actions/pulp3/orchestration/repository/generate_metadata.rb
katello-4.6.1 app/lib/actions/pulp3/orchestration/repository/generate_metadata.rb
katello-4.7.0.rc2 app/lib/actions/pulp3/orchestration/repository/generate_metadata.rb