Bug 2163457

Summary: Remove orphan fails
Product: Red Hat Satellite Reporter: Samir Jha <sajha>
Component: RepositoriesAssignee: Samir Jha <sajha>
Status: CLOSED ERRATA QA Contact: Vladimír Sedmík <vsedmik>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.13.0CC: ashipati, iballou, pcreech, visawant, vsedmik
Target Milestone: 6.13.0Keywords: AcceptanceCriteriaRejected, Regression, Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: rubygem-katello-4.7.0.4-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-05-03 13:24:34 UTC 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 Samir Jha 2023-01-23 14:44:31 UTC
reported in https://community.theforeman.org/t/remove-orphan-fails/30807

when i run manually foreman-rake katello:delete_orphaned_content RAILS_ENV=production
i see 2 tasks getting created
the first run is fine
the second one fails with the error:

undefined method `all?’ for :_created:Symbol
“/usr/share/gems/gems/pulp_rpm_client-3.17.12/lib/pulp_rpm_client/api/repositories_rpm_versions_api.rb:146:in
`list_with_http_info’”
“/usr/share/gems/gems/pulp_rpm_client-3.17.12/lib/pulp_rpm_client/api/repositories_rpm_versions_api.rb:109:in
`list’”
“/usr/share/gems/gems/katello-4.6.0/app/services/katello/pulp3/api/core.rb:194:in
`block in versions_list_for_repository’”
“/usr/share/gems/gems/katello-4.6.0/app/services/katello/pulp3/api/core.rb:245:in
`block in fetch_from_list’”
“/usr/share/gems/gems/katello-4.6.0/app/services/katello/pulp3/api/core.rb:240:in
`loop’”
“/usr/share/gems/gems/katello-4.6.0/app/services/katello/pulp3/api/core.rb:240:in
`fetch_from_list’”
“/usr/share/gems/gems/katello-4.6.0/app/services/katello/pulp3/api/core.rb:194:in
`versions_list_for_repository’”
“/usr/share/gems/gems/katello-4.6.0/app/services/katello/pulp3/smart_proxy_mirror_repository.rb:29:in
`block (2 levels) in orphan_repository_versions’”
“/usr/share/gems/gems/katello-4.6.0/app/services/katello/pulp3/smart_proxy_mirror_repository.rb:28:in
`collect’”
“/usr/share/gems/gems/katello-4.6.0/app/services/katello/pulp3/smart_proxy_mirror_repository.rb:28:in
`block in orphan_repository_versions’”
“/usr/share/gems/gems/katello-4.6.0/app/services/katello/pulp3/smart_proxy_mirror_repository.rb:25:in
`each’”
“/usr/share/gems/gems/katello-4.6.0/app/services/katello/pulp3/smart_proxy_mirror_repository.rb:25:in
`orphan_repository_versions’”
“/usr/share/gems/gems/katello-4.6.0/app/services/katello/pulp3/smart_proxy_repository.rb:39:in
`delete_orphan_repository_versions’”
“/usr/share/gems/gems/katello-4.6.0/app/lib/actions/pulp3/orphan_cleanup/delete_orphan_repository_versions.rb:10:in
`run’”
.....

Comment 1 Samir Jha 2023-01-23 14:44:35 UTC
Created from redmine issue https://projects.theforeman.org/issues/35657

Comment 2 Samir Jha 2023-01-23 14:44:36 UTC
Upstream bug assigned to None

Comment 4 Bryan Kearney 2023-01-24 15:09:10 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/35657 has been resolved.

Comment 7 Vladimír Sedmík 2023-02-07 13:55:07 UTC
Verified in 6.13.0 snap 8.0 (rubygem-katello-4.7.0.5-1.el8sat.noarch)

Steps:
1) Create repos of all types (AC, files, docker, custom rpm, RH rpm, KS), sync to Capsules in Library LCE.
2) Move the Capsules to another LCE and resync them.
3) Run the orphan cleanup and check the results:

[root@sat ~]# foreman-rake katello:delete_orphaned_content RAILS_ENV=production
Orphaned content deletion started in background.
Orphaned content deletion started in background.
Orphaned content deletion started in background.
[root@sat ~]# 
[root@sat ~]# hammer task list --search "orphans"
-------------------------------------|-----------------|---------|---------|---------------------|---------------------|-----------|---------------|------------
ID                                   | ACTION          | STATE   | RESULT  | STARTED AT          | ENDED AT            | DURATION  | OWNER         | TASK ERRORS
-------------------------------------|-----------------|---------|---------|---------------------|---------------------|-----------|---------------|------------
11deac93-6346-45ea-953b-85930cde29ad | Remove orphans  | stopped | success | 2023/02/07 13:43:17 | 2023/02/07 13:43:39 | 22.08375  | foreman_admin |            
36f926fd-0c90-4138-aea7-12a5afd4c710 | Remove orphans  | stopped | success | 2023/02/07 13:43:16 | 2023/02/07 13:43:32 | 15.417211 | foreman_admin |            
90537944-60f3-410d-8503-8864a0f8391c | Remove orphans  | stopped | success | 2023/02/07 13:43:16 | 2023/02/07 13:43:20 | 3.648096  | foreman_admin |  -------------------------------------|-----------------|---------|---------|---------------------|---------------------|-----------|---------------|------------

Comment 10 errata-xmlrpc 2023-05-03 13:24:34 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