Bug 2102260

Summary: Removing repositories associated to content views fails
Product: Red Hat Satellite Reporter: Taft Sanders <tasander>
Component: Content ViewsAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED DUPLICATE QA Contact: Lai <ltran>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.11.0   
Target Milestone: Unspecified   
Target Release: Unused   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-06-29 15:22:15 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 Taft Sanders 2022-06-29 14:25:48 UTC
Description of problem:
When trying to remove/disable a repository from the Satellite WebUI I encounter 2 different errors depending on the content view version association with a lifecycle environment:
- With the repository associated with a CV version associated with a lifecycle, the error returned is:
    "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."

- With the repository associated with a CV version that not associated to a lifecycle, the error returned is:
    "Task aa1ee0da-8f40-4fd8-b60e-3b09c1a8df44: ActiveRecord::DeleteRestrictionError: Cannot delete record because of dependent library_instances_inverse"

with the following methods:
1. WebUI > Content > Red Hat Repositories > Click the blue icon to the right of the enabled repository
2. WebUI > Content > Products > Click product name > check the box for a repository
Version-Release number of selected component (if applicable):


How reproducible:
Every time

Steps to Reproduce:
1. Create, publish and promote a content view with a repository 
2. Ensure the 'delete_repo_across_cv' is set to "YES"
3. Try to remove the repository from the Satellite using one of the methods:
1. WebUI > Content > Red Hat Repositories > Click the blue icon to the right of the enabled repository
2. WebUI > Content > Products > Click product name > check the box for a repository > click "Remove Repositories" > Click "Delete" in pop-up
3. WebUI > Content > Products > Click product name > click the repository name > select action > click "Remove Repository" > Check the box confirming the "Are you sure you want to remove repository <REPO NAME> from all content views?" > Click "Delete"

Version-Release number of selected component (if applicable):
Satellite 6.11 snap 26

Actual results:
Paused tasks are created showing the repository is successfully removed from Pulp3 but failing to remove from Katello

Expected results:
The repository is removed successfully

Additional info:

Comment 2 Taft Sanders 2022-06-29 15:22:15 UTC
Closing as duplicate of https://bugzilla.redhat.com/show_bug.cgi?id=2075673

*** This bug has been marked as a duplicate of bug 2075673 ***