Sha256: 4cb116d6745f1f0e53752f6db14047c5e39ef8fb1f070c2d11bd31665857041a

Contents?: true

Size: 1.31 KB

Versions: 46

Compression:

Stored size: 1.31 KB

Contents

module Actions
  module Katello
    module Repository
      class IndexContent < Actions::EntryAction
        input_format do
          param :id, Integer
          param :source_repository_id
          param :full_index
          param :force_index
        end

        def run
          source_repository = ::Katello::Repository.find(input[:source_repository_id]) if input[:source_repository_id]
          repo = ::Katello::Repository.find(input[:id])

          initial_counts = {}
          repo.repository_type.primary_content_types.each do |content_type|
            initial_counts[content_type.label] = content_type.model_class.in_repositories(repo).count
          end

          if input[:force_index] || (repo.last_contents_changed >= repo.last_indexed)
            repo.index_content(source_repository: source_repository, full_index: input[:full_index].present?)
            repo.update(:last_indexed => DateTime.now)
          else
            output[:index_skipped] = true
          end

          output[:new_content] = {}
          repo.repository_type.primary_content_types.each do |content_type|
            new_count = content_type.model_class.in_repositories(repo).count
            output[:new_content][content_type.label] = new_count - initial_counts[content_type.label]
          end
        end
      end
    end
  end
end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
katello-4.8.4 app/lib/actions/katello/repository/index_content.rb
katello-4.9.1 app/lib/actions/katello/repository/index_content.rb
katello-4.8.3 app/lib/actions/katello/repository/index_content.rb
katello-4.9.0 app/lib/actions/katello/repository/index_content.rb
katello-4.7.6 app/lib/actions/katello/repository/index_content.rb
katello-4.8.2 app/lib/actions/katello/repository/index_content.rb
katello-4.9.0.rc2 app/lib/actions/katello/repository/index_content.rb
katello-4.9.0.rc1 app/lib/actions/katello/repository/index_content.rb
katello-4.8.1 app/lib/actions/katello/repository/index_content.rb
katello-4.7.5 app/lib/actions/katello/repository/index_content.rb
katello-4.8.0 app/lib/actions/katello/repository/index_content.rb
katello-4.8.0.rc2 app/lib/actions/katello/repository/index_content.rb
katello-4.7.4 app/lib/actions/katello/repository/index_content.rb
katello-4.8.0.rc1 app/lib/actions/katello/repository/index_content.rb
katello-4.7.3 app/lib/actions/katello/repository/index_content.rb
katello-4.7.2 app/lib/actions/katello/repository/index_content.rb
katello-4.7.1 app/lib/actions/katello/repository/index_content.rb
katello-4.6.2.1 app/lib/actions/katello/repository/index_content.rb
katello-4.6.2 app/lib/actions/katello/repository/index_content.rb
katello-4.7.0 app/lib/actions/katello/repository/index_content.rb