Bug 2141063

Summary: [RFE] Unable to delete repository if it was included to composite CV
Product: Red Hat Satellite Reporter: Marek Hulan <mhulan>
Component: Content ViewsAssignee: satellite6-bugs <satellite6-bugs>
Status: NEW --- QA Contact: Satellite QE Team <sat-qe-bz-list>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.10.0CC: sajha, saydas
Target Milestone: UnspecifiedKeywords: FutureFeature, RFE, UserExperience
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Marek Hulan 2022-11-08 16:27:00 UTC
Description of problem:
As a user I'm unable to find which content view is preventing repository from being deleted
if repository is included to removed version of content view which was included into composite
content view (yeah, it was complex, I know :D).

Steps to Reproduce:
1. Create repository X;
2. Create content view A;
3. Include repository X to content view A;
4. Publish content view A to library;
5. Create composite content view B;
6. Include content view A to composite content view B;
7. Publish content view B to library;
8. Remove all versions of content view A;
9. Try to remove repository X.

Actual results:
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 deleting it.

Expected results:
Either indicate content view id which is preventing repository removal or
prevent content view versions from being deleted if it was included into composite content view.

Additional info:
# hammer content-view list
can't help in this situation as it was not showing repository ids for composite content views.

# rpm -qa | grep katello
katello-installer-base-2.2.2-1.el7.noarch
katello-service-2.2.1-0.el7.noarch
katello-debug-2.2.1-0.el7.noarch
katello-selinux-2.2.1-1.el7.noarch
katello-common-2.2.1-0.el7.noarch
katello-server-ca-1.0-2.noarch
katello-certs-tools-2.0.1-1.el7.noarch
katello-default-ca-1.0-1.noarch
katello-agent-2.2.1-1.el7.noarch
rubygem-hammer_cli_katello-0.0.14-1.el7.noarch
katello-2.2.1-0.el7.noarch
ruby193-rubygem-katello-2.2.2-2.el7.noarch
katello-installer-2.2.2-1.el7.noarch
pulp-katello-0.4-1.el7.noarch

Comment 1 Marek Hulan 2022-11-08 16:27:04 UTC
Created from redmine issue https://projects.theforeman.org/issues/11760

Comment 2 Marek Hulan 2022-11-08 16:27:05 UTC
Upstream bug assigned to None

Comment 3 Sayan Das 2023-05-10 17:27:25 UTC
Would https://bugzilla.redhat.com/show_bug.cgi?id=2123932 not resolv the main concern here ?

That new feature for force deletion of a repo works very well whether It was included in CV or CCV ( and several versions of them ). So a user would not need to know where the repository is. If the goal is to delete the repo without needing to re-publish the CV or CCVs, this is the option to go for.


And in case the user wants to find out related CV or CCV versions, They can do it with this rake ( where 52 is the ID of the repo taken from "hammer repository list" command ):

# cat << EOF | foreman-rake console
conf.echo = false
Katello::Repository.find(52).clones.each { |repo| puts "Repo => #{repo.name} | CV => #{repo.content_view.name} | Version => #{repo.content_view_version.version} | Version_ID => #{repo.content_view_version.id} | Lifecycle => #{repo.content_view_version.environments.map(&:name).join(',')}"}  ; nil
EOF