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 2056568

Summary: Katello doesn't create a new publication for default organization repos when importing a content view version with new contents
Product: Red Hat Satellite Reporter: Hao Chang Yu <hyu>
Component: Inter Satellite SyncAssignee: Chris Roberts <chrobert>
Status: CLOSED DUPLICATE QA Contact: Radek Mynar <rmynar>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.10.2CC: chrobert, janarula, jpasqual, paji, pcreech, vsedmik, wpinheir
Target Milestone: 6.11.0Keywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: https://projects.theforeman.org/issues/34384
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-04-11 09:45:05 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 2022-02-21 13:53:30 UTC
Description of problem:
Katello doesn't create a new publication for default organization repos when importing a content view version with new contents

Steps to Reproduce:

On the connected Satellite:
1. Create a custom repo and upload 1 rpm to it.
2. Create a content view and attach the custom repo.
3. Publish content view version 1.0.
4. Export content view version 1.0
 
hammer content-export complete version --organization-id 1 --content-view-id <cv id> --lifecycle-environment Library --version 1

5. Upload 1 new rpm to the custom repo
6. Publish content view version 2.0
7. Export content view version 2.0

hammer content-export complete version --organization-id 1 --content-view-id <cv id> --lifecycle-environment Library --version 2

8. Copy the exported files to the disconnect Satellite.


On the disconnected Satellite:
9. Import content view version 1.0

hammer content-import version --organization-id 1 --path /var/lib/pulp/imports/<cv version 1 export files path>

10. Register a client to the disconnected Satellite and enable the custom repo then run yum to inspect the repo. The repo should have only 1 rpm.

yum clean all
yum repolist -v

11. Import content view version 2.0
12. Go back to the client and inspect the repo again.

yum clean all
yum repolist -v


Actual results:
Still getting 1 rpm


Expected results:
Should get 2 rpms


Additional info:

The first import task has the following actions but they are not in the 2nd import task:
64: Actions::Pulp3::Repository::CreatePublication (success) [ 0.89s / 0.31s ]
66: Actions::Pulp3::Repository::SavePublication (success) [ 0.03s / 0.03s ]

The following command doesn't solve the issue:

hammer content-view version republish-repositories --content-view-id 1 --version 1.0 --force yes


The repo can be fixed by forcing the publication:

foreman-rake console
Katello::Repository.where(id: [<default org repo id>], library_instance_id: nil).each {|repo| ForemanTasks.async_task(Actions::Katello::Rep
ository::MetadataGenerate, repo, force_publication: true) }
exit

Comment 1 Chris Roberts 2022-03-01 17:28:21 UTC
I followed the steps on my devel box and confirmed this works on master. I will link up the redmine/github issue.

First export:

Repo-id      : food_custom-ex_zoo
Repo-name    : zoo
Repo-revision: 1646155012
Repo-updated : Tue Mar  1 17:16:52 2022
Repo-pkgs    : 32
Repo-size    : 77 k
Repo-baseurl : https://centos7-katello-devel.vault111.example.com/pulp/content/food/Library/view/custom/custom-ex/zoo/
Repo-expire  : 1 second(s) (last: Tue Mar  1 17:21:04 2022)
  Filter     : read-only:present
Repo-filename: /etc/yum.repos.d/redhat.repo

Second export:

Repo-id      : food_custom-ex_zoo
Repo-name    : zoo
Repo-revision: 1646155363
Repo-updated : Tue Mar  1 17:22:43 2022
Repo-pkgs    : 31
Repo-size    : 74 k
Repo-baseurl : https://centos7-katello-devel.vault111.example.com/pulp/content/food/Library/view/custom/custom-ex/zoo/
Repo-expire  : 1 second(s) (last: Tue Mar  1 17:23:32 2022)
  Filter     : read-only:present
Repo-filename: /etc/yum.repos.d/redhat.repo