Bug 2266149

Summary: 'Remove orphans' task fails on DeleteOrphanAlternateContentSources step
Product: Red Hat Satellite Reporter: Odilon Sousa <osousa>
Component: Alternate Content SourcesAssignee: Samir Jha <sajha>
Status: CLOSED ERRATA QA Contact: Vladimír Sedmík <vsedmik>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.13.0CC: ahumbe, aruzicka, lufu, qjames, rlavi, sajha, vsedmik
Target Milestone: 6.14.3Keywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: rubygem-katello-4.9.0.22 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 2208310 Environment:
Last Closed: 2024-03-27 13:19:18 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:

Comment 2 Bryan Kearney 2024-02-26 20:04:01 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/36461 has been resolved.

Comment 3 Vladimír Sedmík 2024-03-06 10:56:07 UTC
Verified in 6.14.3 snap 1.0

Steps:
1. Have a Satellite with registered external Capsule.
2. Disable File content on the Capsule:
[root@caps ~]# satellite-installer --foreman-proxy-content-enable-file false
3. In Administer > Settings set "Orphaned Content Protection Time" to 1
4. Run the orphan cleanup task from Satellite and check it succeeds on both, Sat and Caps:
[root@sat ~]# foreman-rake katello:delete_orphaned_content RAILS_ENV=production
5. Mock the katello/app/services/katello/pulp3/smart_proxy_mirror_repository.rb as per https://github.com/Katello/katello/pull/10582, restart services, rerun the cleanup and check it succeeded:
[root@sat ~]# grep /usr/share/gems/gems/katello-4.9.0.23/app/services/katello/pulp3/smart_proxy_mirror_repository.rb -n -e file2
82:        if RepositoryTypeManager.enabled_repository_types['file2']
83:          file_acs_api = ::Katello::Pulp3::Repository.api(smart_proxy, 'file2').alternate_content_source_api
[root@sat ~]# foreman-maintain service restart
[root@sat ~]# foreman-rake katello:delete_orphaned_content RAILS_ENV=production
[root@sat ~]# hammer task list --search orphans
-------------------------------------|-----------------|---------|---------|---------------------|---------------------|----------|---------------|------------
ID                                   | ACTION          | STATE   | RESULT  | STARTED AT          | ENDED AT            | DURATION | OWNER         | TASK ERRORS
-------------------------------------|-----------------|---------|---------|---------------------|---------------------|----------|---------------|------------
258ce943-3f85-4a53-825f-c79365411ff8 | Remove orphans  | stopped | success | 2024/03/06 10:44:58 | 2024/03/06 10:44:58 | 0.782981 | foreman_admin |            
d1a8deaa-8687-4900-a5bf-22ce1bab3e62 | Remove orphans  | stopped | success | 2024/03/06 10:44:57 | 2024/03/06 10:44:59 | 1.741113 | foreman_admin |            
cc71ead9-5f67-4928-bb57-91ccf5ec5c69 | Remove orphans  | stopped | success | 2024/03/06 10:38:01 | 2024/03/06 10:38:02 | 1.327502 | foreman_admin |            
858337bf-ca03-4e2c-845f-4ac317d5127e | Remove orphans  | stopped | success | 2024/03/06 10:38:00 | 2024/03/06 10:38:02 | 2.008432 | foreman_admin |            
7cf3cac3-c12e-4786-a8d0-5fe19fecb6b2 | Remove orphans  | stopped | success | 2024/03/06 10:23:15 | 2024/03/06 10:23:16 | 1.48405  | foreman_admin |            
7f2a0c7f-e21f-4cae-8834-39b29fb46594 | Remove orphans  | stopped | success | 2024/03/06 10:23:14 | 2024/03/06 10:23:17 | 2.456396 | foreman_admin |            
-------------------------------------|-----------------|---------|---------|---------------------|---------------------|----------|---------------|------------

Comment 8 errata-xmlrpc 2024-03-27 13:19:18 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 (Moderate: Satellite 6.14.3 Async Security Update), 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-2024:1536