Bug 2123932 - Unable to "Remove" a repository directly if the repo is part of a CV as well as CCV in Satellite 6.12
Summary: Unable to "Remove" a repository directly if the repo is part of a CV as well ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Repositories
Version: 6.12.0
Hardware: All
OS: All
medium
high
Target Milestone: 6.13.0
Assignee: Samir Jha
QA Contact: Jeremy Lenz
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-09-03 07:02 UTC by Sayan Das
Modified: 2023-07-26 10:20 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-05-03 13:21:46 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 35549 0 Normal Closed Unable to "Remove" a repository directly if the repo is part of a CV as well as CCV in Satellite 6.12 2022-12-01 15:55:21 UTC
Red Hat Issue Tracker SAT-12848 0 None None None 2022-11-18 00:26:08 UTC
Red Hat Product Errata RHSA-2023:2097 0 None None None 2023-05-03 13:21:59 UTC

Description Sayan Das 2022-09-03 07:02:51 UTC
Description of problem:

Satellite 6.11 has introduced a very nice feature where if "Allow deleting repositories in published content views" is enabled in settinfs, that allows to *delete* (not disable) any repos ( Redhat\Custom ) from Satellite even if they are part of any CVs i.e. if we delete any repos using Content --> Products --> <Repo> --> Select Action --> Remove Repository , Then It will delete all reference of the repo from all related CVs and will work fine.

It sounds dengerous but It works great and does not breaks the CVs at all. 

Now this feature works great if we are only expecting the CV to be present in Component Content Views i.e. normal CVs. But if the same repo is present in a CCV as well, Then one of the deletion attempts at the backend will fail with error:
~~
Task 9e9edf11-ecd0-4fc5-9b71-936fb3b68f9c: RuntimeError: Repository cannot be deleted since it has already been included in a published Content View. Please delete all Content View versions containing this repository before attempting to delete it.
~~


Version-Release number of selected component (if applicable):

Satellite 6.12  ( I never tested on 6.11 but Hopefully it is reproducible there as well )



How reproducible:

Always


Steps to Reproduce:
1. Install a Satellite 6.12
2. Import a manifest
3. Enable any three rhel repos and sync them ( take satellite-clients i guess )
4. Create an environment path by name "Test" after "Library" lifecycle. 
5. Create a CV by name TCV1, include any two out of three repos there and Publish it to Library
6. Create another CV by name TCV2, include the last remaining repos in that CV and Publish it to Library
7. Create a CCV by name TCCV, include the latest versions of TCV1 and TCV2 in the TCCV and Publish to Library.
8. Republish a new version of the TCCV and force publish+promote it to Library as well as "Test" environment.
9. Go to Content --> Products --> Click open a product --> Click open one of the repos --> Select Action --> Remove Repository


Actual results:

Three tasks will be generated. Out of all, two will be successful ( which are related to repo instances from CV ) but one task will go to Paused state ( which is related to the main repo ) and throw the error:

Task 9e9edf11-ecd0-4fc5-9b71-936fb3b68f9c: RuntimeError: Repository cannot be deleted since it has already been included in a published Content View. Please delete all Content View versions containing this repository before attempting to delete it.

I believe this is happening as the CCV-related instance of the repo never got deleted i.e. The action only deleted the Pulp IDs from CVs and then straightaway tried to delete the main repo but It left the CCV untouched. 


Expected results:

The feature should properly work when the repos are part of CCV as well.


Additional info:

Logs will be attached later.

Comment 7 Samir Jha 2022-09-21 13:06:37 UTC
Created redmine issue https://projects.theforeman.org/issues/35549 from this bug

Comment 8 Bryan Kearney 2022-09-22 20:04:11 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/35549 has been resolved.

Comment 9 Jeremy Lenz 2023-01-18 18:08:58 UTC
Steps I followed:

Create and sync a repo
Add repo to a component content view and publish
Create a composite content view and add the component content view from above with latest version.
Publish the composite content view.
Verify you see the repository in version details of the newly published version.
Go to the repository's details page and click Select Action > Remove Repository

* The composite content view now shows in the confirmation modal.
* The Delete task succeeds with no errors.
* After removing the repository, the composite CV version remains, but does not have the content.
* The associated Red Hat repository now shows as disabled on the RH Repos page.

Verified in 6.13.0 snap 6

Comment 12 errata-xmlrpc 2023-05-03 13:21:46 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 (Important: Satellite 6.13 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-2023:2097


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