Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 2033187

Summary: Complete repository sync is no longer working since Satellite 6.9
Product: Red Hat Satellite Reporter: Hao Chang Yu <hyu>
Component: RepositoriesAssignee: Justin Sherrill <jsherril>
Status: CLOSED ERRATA QA Contact: Cole Higgins <chiggins>
Severity: high Docs Contact:
Priority: high    
Version: 6.9.7CC: ahumbe, dhjoshi, jpasqual, jsherril, ktordeur, ldelouw, momran, pcfe, saydas, zhunting
Target Milestone: 6.9.8Keywords: Patch, Regression, Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: tfm-rubygem-katello-3.18.1.49-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-01-27 17:33:09 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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