Sha256: 5023a4b20b9e18b7c3fc931dc35b0db5c3b9848dc03c71ef623974778fbd221d

Contents?: true

Size: 1.74 KB

Versions: 13

Compression:

Stored size: 1.74 KB

Contents

module Actions
  module Katello
    module Repository
      class CheckMatchingContent < Actions::Base
        input_format do
          param :source_repo
          param :target_repo
        end

        # Check if content in the repositories has changed. We can use
        # this info to skip regenerating metadata in pulp, keeping the
        # revision number on the repo the same
        def run
          source_repo = ::Katello::Repository.find(input[:source_repo_id])
          target_repo = ::Katello::Repository.find(input[:target_repo_id])

          rpms = rpms_match?(source_repo, target_repo)
          errata = errata_match?(source_repo, target_repo)
          package_groups = package_groups_match?(source_repo, target_repo)
          distributions = distributions_match?(source_repo, target_repo)

          output[:matching_content] = rpms && errata && package_groups && distributions
        end

        def rpms_match?(source_repo, target_repo)
          source_repo_ids = source_repo.rpm_ids.sort
          target_repo_ids = target_repo.rpm_ids.sort
          source_repo_ids == target_repo_ids
        end

        def errata_match?(source_repo, target_repo)
          source_repo_ids = source_repo.erratum_ids.sort
          target_repo_ids = target_repo.erratum_ids.sort
          source_repo_ids == target_repo_ids
        end

        def package_groups_match?(source_repo, target_repo)
          source_repo_ids = source_repo.package_group_ids.sort
          target_repo_ids = target_repo.package_group_ids.sort
          source_repo_ids == target_repo_ids
        end

        def distributions_match?(source_repo, target_repo)
          source_repo.distribution_information == target_repo.distribution_information
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
katello-3.5.0.1 app/lib/actions/katello/repository/check_matching_content.rb
katello-3.5.0 app/lib/actions/katello/repository/check_matching_content.rb
katello-3.5.0.rc2 app/lib/actions/katello/repository/check_matching_content.rb
katello-3.5.0.rc1 app/lib/actions/katello/repository/check_matching_content.rb
katello-3.4.5 app/lib/actions/katello/repository/check_matching_content.rb
katello-3.4.4 app/lib/actions/katello/repository/check_matching_content.rb
katello-3.4.2 app/lib/actions/katello/repository/check_matching_content.rb
katello-3.4.1 app/lib/actions/katello/repository/check_matching_content.rb
katello-3.4.0.2 app/lib/actions/katello/repository/check_matching_content.rb
katello-3.4.0.1 app/lib/actions/katello/repository/check_matching_content.rb
katello-3.4.0 app/lib/actions/katello/repository/check_matching_content.rb
katello-3.4.0.rc2 app/lib/actions/katello/repository/check_matching_content.rb
katello-3.4.0.rc1 app/lib/actions/katello/repository/check_matching_content.rb