Bug 2033187 - Complete repository sync is no longer working since Satellite 6.9
Summary: Complete repository sync is no longer working since Satellite 6.9
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Repositories
Version: 6.9.7
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: 6.9.8
Assignee: Justin Sherrill
QA Contact: Cole Higgins
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-12-16 07:25 UTC by Hao Chang Yu
Modified: 2022-01-27 17:33 UTC (History)
10 users (show)

Fixed In Version: tfm-rubygem-katello-3.18.1.49-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-01-27 17:33:09 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2022:0320 0 None None None 2022-01-27 17:33:17 UTC

Description Hao Chang Yu 2021-12-16 07:25:29 UTC
Description of problem:
I notice that complete repo sync and validate contents sync are not doing "force_full" sync on Satellite 6.9. This function is important especially for the Pulp 2 to Pulp 3 migration when Satellite has some missing data and corrupted contents. For example, contents are not migrated to Pulp 3 due to missing lazy catalog entries in the mongodb. To fix issue, force_full repo sync is needed.

The root cause is Foreman task doesn't pass the "force_full" option to Pulp correctly when initializing the sync task.

# app/lib/actions/katello/repository/sync.rb
module Actions
  module Katello
    module Repository
      class Sync < Actions::EntryAction
          ...
          #pulp2 options
          pulp_sync_options[:force_full] = true if skip_metadata_check && repo.yum? <=============
          pulp_sync_options[:repair_sync] = true if validate_contents && repo.deb?
          pulp_sync_options[:remove_missing] = false if incremental
          pulp_sync_options[:source_url] = source_url

          #pulp3 options
          pulp_sync_options[:optimize] = false if skip_metadata_check && repo.yum?
  
          sequence do
            if SmartProxy.pulp_primary.pulp3_support?(repo) && validate_contents
              plan_action(Katello::Repository::VerifyChecksum, repo)
            else
              plan_action(Pulp::Repository::RemoveUnits, :repo_id => repo.id, :content_unit_type => ::Katello::YumMetadataFile::CONTENT_TYPE) if validate_contents && repo.yum?
              sync_action = plan_pulp_action([Actions::Pulp::Orchestration::Repository::Sync,
                                              Actions::Pulp3::Orchestration::Repository::Sync],
                                             repo,
                                             SmartProxy.pulp_primary,
                                             pulp_sync_options)  <========================== the sync options are not parsed in input[:options] format



# app/lib/actions/pulp/repository/sync.rb
module Actions
  module Pulp
    module Repository
      class Sync < Pulp::AbstractAsyncTask
        include Helpers::Presenter

        input_format do
          param :repo_id
          param :source_url # allow overriding the feed URL
          param :options # Pulp sync options
        end

        def invoke_external_task
          overrides = {}
          overrides[:feed] = input[:source_url] if input[:source_url]
          overrides[:validate] = !(SETTINGS[:katello][:pulp][:skip_checksum_validation])
          overrides.merge(input[:options]) if input[:options]  <=============== input[:options] is empty. The "sync" method expect options in overrides[:options]
          repo = ::Katello::Repository.find(input[:repo_id])

          output[:pulp_tasks] = repo.backend_service(::SmartProxy.pulp_primary).sync(overrides)
        end


How reproducible:
Always


Steps to Reproduce:
1. On web ui sync one repo to make sure it is up to date.
2. Sync the repo again with "complete" sync.
3. Check /var/log/messages

Actual results:
pulp: pulp_rpm.plugins.importers.yum.sync:INFO: [df9f139a] Parsing metadata.
pulp: pulp_rpm.plugins.importers.yum.sync:INFO: [df9f139a] upstream repo metadata has not changed. Skipping steps.

Expected results:
pulp: pulp_rpm.plugins.importers.yum.sync:INFO: [0d1b8905] Parsing metadata.
pulp: pulp.server.controllers.repository:INFO: [0d1b8905] Fully resyncing due to use of force_full in config


Additional info:

Workaround is to use pulp-admin to force_full sync the repo

pulp-admin rpm repo sync run --repo-id <repo backend identifier> --force-full

Comment 9 errata-xmlrpc 2022-01-27 17:33:09 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Satellite 6.9.8 Async Bug Fix Update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2022:0320


Note You need to log in before you can comment on or make changes to this bug.