Class: Actions::Katello::Repository::CheckMatchingContent
- Inherits:
-
Base
- Object
- Base
- Actions::Katello::Repository::CheckMatchingContent
- Defined in:
- app/lib/actions/katello/repository/check_matching_content.rb
Instance Method Summary collapse
- #debs_match?(source_repo, target_repo) ⇒ Boolean
- #distributions_match?(source_repo, target_repo) ⇒ Boolean
- #errata_match?(source_repo, target_repo) ⇒ Boolean
- #package_groups_match?(source_repo, target_repo) ⇒ Boolean
- #rpms_match?(source_repo, target_repo) ⇒ Boolean
-
#run ⇒ Object
Check if content in the repositories has changed.
- #srpms_match?(source_repo, target_repo) ⇒ Boolean
Instance Method Details
#debs_match?(source_repo, target_repo) ⇒ Boolean
37 38 39 |
# File 'app/lib/actions/katello/repository/check_matching_content.rb', line 37 def debs_match?(source_repo, target_repo) source_repo.deb_ids.sort == target_repo.deb_ids.sort end |
#distributions_match?(source_repo, target_repo) ⇒ Boolean
65 66 67 |
# File 'app/lib/actions/katello/repository/check_matching_content.rb', line 65 def distributions_match?(source_repo, target_repo) source_repo.distribution_information == target_repo.distribution_information end |
#errata_match?(source_repo, target_repo) ⇒ Boolean
53 54 55 56 57 |
# File 'app/lib/actions/katello/repository/check_matching_content.rb', line 53 def errata_match?(source_repo, target_repo) source_repo_ids = source_repo.erratum_ids.sort.uniq target_repo_ids = target_repo.erratum_ids.sort.uniq source_repo_ids == target_repo_ids end |
#package_groups_match?(source_repo, target_repo) ⇒ Boolean
59 60 61 62 63 |
# File 'app/lib/actions/katello/repository/check_matching_content.rb', line 59 def package_groups_match?(source_repo, target_repo) source_repo_ids = source_repo.package_groups.order(:name).pluck(:name).uniq target_repo_ids = target_repo.package_groups.order(:name).pluck(:name).uniq source_repo_ids == target_repo_ids end |
#rpms_match?(source_repo, target_repo) ⇒ Boolean
47 48 49 50 51 |
# File 'app/lib/actions/katello/repository/check_matching_content.rb', line 47 def rpms_match?(source_repo, target_repo) source_repo_ids = source_repo.rpm_ids.sort.uniq target_repo_ids = target_repo.rpm_ids.sort.uniq source_repo_ids == target_repo_ids end |
#run ⇒ Object
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
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'app/lib/actions/katello/repository/check_matching_content.rb', line 13 def run source_repo = ::Katello::Repository.find(input[:source_repo_id]) target_repo = ::Katello::Repository.find(input[:target_repo_id]) target_repo_published = target_repo.backend_service(SmartProxy.pulp_primary).published? if source_repo.content_type == ::Katello::Repository::YUM_TYPE srpms_match = srpms_match?(source_repo, target_repo) 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) checksum_match = (target_repo.saved_checksum_type == source_repo.saved_checksum_type) output[:checksum_match] = checksum_match output[:matching_content] = srpms_match && rpms && errata && package_groups && distributions && target_repo_published && checksum_match end if source_repo.deb? debs = debs_match?(source_repo, target_repo) output[:matching_content] = debs && target_repo_published end end |
#srpms_match?(source_repo, target_repo) ⇒ Boolean
41 42 43 44 45 |
# File 'app/lib/actions/katello/repository/check_matching_content.rb', line 41 def srpms_match?(source_repo, target_repo) source_repo_ids = source_repo.srpm_ids.sort.uniq target_repo_ids = target_repo.srpm_ids.sort.uniq source_repo_ids == target_repo_ids end |