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 2034461 - Capsule failed to sync empty repositories
Summary: Capsule failed to sync empty repositories
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Pulp
Version: 6.10.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: 6.11.0
Assignee: satellite6-bugs
QA Contact: Vladimír Sedmík
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-12-21 02:13 UTC by Hao Chang Yu
Modified: 2022-07-05 14:31 UTC (History)
9 users (show)

Fixed In Version: pulp-rpm-3.17.0
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-07-05 14:31:12 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github pulp pulp_rpm issues 2316 0 None closed Sync optimization can result in invalid publications in combination with sync_policy=mirror_complete 2022-04-18 18:39:27 UTC
Red Hat Product Errata RHSA-2022:5498 0 None None None 2022-07-05 14:31:28 UTC

Description Hao Chang Yu 2021-12-21 02:13:58 UTC
Description of problem:
Capsule failed to sync an empty repository with the following error while refreshing the distribution.

12: Actions::Pulp3::CapsuleContent::RefreshDistribution (skipped) [ 2.47s / 2.05s ]
Queue: default

Started at: 2021-12-16 08:42:24 UTC
Ended at: 2021-12-16 08:42:26 UTC
Real time: 2.47s
Execution time (excluding suspended state): 2.05s

Input:
---
repository_id: 78
smart_proxy_id: 2
options:
  contents_changed: true
<snip>
Output:

--- {}
Error:

NoMethodError

Error:
NoMethodError
undefined method `pulp_href' for nil:NilClass
---
- "/opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.1.1.39/app/services/katello/pulp3/repository_mirror.rb:78:in
  `publication_href'"
- "/opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.1.1.39/app/services/katello/pulp3/repository_mirror.rb:164:in
  `refresh_distributions'"
- "/opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.1.1.39/app/lib/actions/pulp3/capsule_content/refresh_distribution.rb:17:in
  `invoke_external_task'"
- "/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.9/lib/dynflow/action/polling.rb:84:in
  `initiate_external_action'"
- "/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.9/lib/dynflow/action/polling.rb:19:in
  `run'"
- "/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.9/lib/dynflow/action/cancellable.rb:14:in
  `run'"
- "/opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.1.1.39/app/lib/actions/pulp3/abstract_async_task.rb:10:in
  `run'"
- "/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.9/lib/dynflow/action.rb:572:in
  `block (3 levels) in execute_run'"
- "/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.9/lib/dynflow/middleware/stack.rb:27:in
<snip>


I think it is because mirror repository won't create a publication for empty repository.

# Capsule pulpcore database
pulpcore=# select pulp_id, name, next_version, pulp_type from core_repository where pulp_id = '7effd787-066f-4359-ac28-abd5f1bb91eb';
               pulp_id                |                            name                             | next_version | pulp_type 
--------------------------------------+-------------------------------------------------------------+--------------+-----------
 7effd787-066f-4359-ac28-abd5f1bb91eb | 1-empty-cv-development-909fee88-367c-4310-851d-9a9ebf66087c |            1 | rpm.rpm
(1 row)

pulpcore=# select * from core_repositoryversion where repository_id = '7effd787-066f-4359-ac28-abd5f1bb91eb';
               pulp_id                |         pulp_created          |       pulp_last_updated       | number | complete | base_version_id |            repository_id             
--------------------------------------+-------------------------------+-------------------------------+--------+----------+-----------------+--------------------------------------
 2689f18b-a003-4bca-8185-54d896cdedee | 2021-12-16 18:39:08.434498+10 | 2021-12-16 18:39:08.434517+10 |      0 | t        |                 | 7effd787-066f-4359-ac28-abd5f1bb91eb
(1 row)

pulpcore=# select * from core_publication where repository_version_id = '2689f18b-a003-4bca-8185-54d896cdedee';
 pulp_id | pulp_created | pulp_last_updated | pulp_type | complete | pass_through | repository_version_id 
---------+--------------+-------------------+-----------+----------+--------------+-----------------------
(0 rows)  <======== No publication created


Steps to Reproduce:
1. Create or enable a repository, don't sync it or add any content.
2. Create a content view and add the new repo to it
3. Create a new LCE, such as 'dev' and ensure it is added to the Capsule.
4. Publish and promote the new content view which should trigger a capsule sync.
5. If not just trigger a complete capsule sync.

Actual results:
undefined method `pulp_href' for nil:NilClass

Expected results:
No error

Comment 1 Brad Buckingham 2022-01-05 14:52:15 UTC
Is this a regression from prior releases?

Comment 2 Hao Chang Yu 2022-01-06 01:00:02 UTC
(In reply to Brad Buckingham from comment #1)
> Is this a regression from prior releases?

No. It is the regression of current release

Comment 8 Vladimír Sedmík 2022-04-27 14:15:55 UTC
Verified on 6.11.0 snap 17 at rhel7 and rhel8 (with tfm-pulpcore-python3-pulp-rpm-3.17.3-2.el7pc.noarch and python38-pulp-rpm-3.17.3-2.el8pc.noarch):
Following the steps from comment 0 using empty custom or unsynced RH repo I was not able to reproduce the error - all capsule syncs succeeded without errors, regardless the download or mirroring policy or the sync type.

Comment 11 errata-xmlrpc 2022-07-05 14:31:12 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 (Moderate: Satellite 6.11 Release), 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/RHSA-2022:5498


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