Bug 2208310

Summary: 'Remove orphans' task fails on DeleteOrphanAlternateContentSources step
Product: Red Hat Satellite Reporter: Jan Senkyrik <jsenkyri>
Component: Alternate Content SourcesAssignee: Samir Jha <sajha>
Status: CLOSED ERRATA QA Contact: Vladimír Sedmík <vsedmik>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.13.0CC: ahumbe, aruzicka, lufu, qjames, rlavi, sajha, vsedmik
Target Milestone: 6.15.0Keywords: Triaged
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:
: 2266149 (view as bug list) Environment:
Last Closed: 2024-04-23 17:11:14 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 Jan Senkyrik 2023-05-18 14:44:22 UTC
Description of problem:
Remove orphans task fails on Capsule servers. It executes successfully on the Satellite server itself.

Here are task details:

# hammer task info --id 19c79c4f-eaea-4739-bea0-a8aec0f595c0
~~~
ID:          19c79c4f-eaea-4739-bea0-a8aec0f595c0
Action:      Remove orphans
State:       paused
Result:      error
Started at:  2023/05/14 20:00:28
Ended at:
Duration:    61876.254165
Owner:       foreman_admin
Task errors: undefined method `pulp3_api' for nil:NilClass

Details:
Errors: undefined method `pulp3_api' for nil:NilClass
Action: Actions::Pulp3::OrphanCleanup::DeleteOrphanAlternateContentSources
Exception: NoMethodError: undefined method `pulp3_api' for nil:NilClass
Stack: 2023-05-14T22:00:58 [E|bac|] undefined method `pulp3_api' for nil:NilClass (NoMethodError)
 | /usr/share/gems/gems/katello-4.7.0.23/app/services/katello/pulp3/repository.rb:42:in `api'
 | /usr/share/gems/gems/katello-4.7.0.23/app/services/katello/pulp3/smart_proxy_mirror_repository.rb:82:in `delete_orphan_alternate_content_sources'
 | /usr/share/gems/gems/katello-4.7.0.23/app/lib/actions/pulp3/orphan_cleanup/delete_orphan_alternate_content_sources.rb:11:in `invoke_external_task'
 | /usr/share/gems/gems/dynflow-1.6.10/lib/dynflow/action/polling.rb:84:in `initiate_external_action'
 | /usr/share/gems/gems/dynflow-1.6.10/lib/dynflow/action/polling.rb:19:in `run'
 | /usr/share/gems/gems/dynflow-1.6.10/lib/dynflow/action/cancellable.rb:14:in `run'
 | /usr/share/gems/gems/katello-4.7.0.23/app/lib/actions/pulp3/abstract_async_task.rb:10:in `run'
 | /usr/share/gems/gems/dynflow-1.6.10/lib/dynflow/action.rb:582:in `block (3 levels) in execute_run'
 | /usr/share/gems/gems/dynflow-1.6.10/lib/dynflow/middleware/stack.rb:27:in `pass'
 | /usr/share/gems/gems/dynflow-1.6.10/lib/dynflow/middleware.rb:19:in `pass'
 | /usr/share/gems/gems/dynflow-1.6.10/lib/dynflow/middleware.rb:32:in `run'
 | /usr/share/gems/gems/dynflow-1.6.10/lib/dynflow/middleware/stack.rb:23:in `call'
 | /usr/share/gems/gems/dynflow-1.6.10/lib/dynflow/middleware/stack.rb:27:in `pass'
 | /usr/share/gems/gems/dynflow-1.6.10/lib/dynflow/middleware.rb:19:in `pass'
 | /usr/share/gems/gems/katello-4.7.0.23/app/lib/actions/middleware/remote_action.rb:16:in `block in run'
 | /usr/share/gems/gems/katello-4.7.0.23/app/lib/actions/middleware/remote_action.rb:40:in `block in as_remote_user'
 | /usr/share/gems/gems/katello-4.7.0.23/app/models/katello/concerns/user_extensions.rb:21:in `cp_config'
 | /usr/share/gems/gems/katello-4.7.0.23/app/lib/actions/middleware/remote_action.rb:27:in `as_cp_user'
 | /usr/share/gems/gems/katello-4.7.0.23/app/lib/actions/middleware/remote_action.rb:39:in `as_remote_user'
 | /usr/share/gems/gems/katello-4.7.0.23/app/lib/actions/middleware/remote_action.rb:16:in `run'
 | /usr/share/gems/gems/dynflow-1.6.10/lib/dynflow/middleware/stack.rb:23:in `call'
 | /usr/share/gems/gems/dynflow-1.6.10/lib/dynflow/middleware/stack.rb:27:in `pass'
 | /usr/share/gems/gems/dynflow-1.6.10/lib/dynflow/middleware.rb:19:in `pass'
 | /usr/share/gems/gems/foreman-tasks-7.2.1/app/lib/actions/middleware/rails_executor_wrap.rb:14:in `block in run'
 | /usr/share/gems/gems/activesupport-6.1.7/lib/active_support/execution_wrapper.rb:91:in `wrap'
 | /usr/share/gems/gems/foreman-tasks-7.2.1/app/lib/actions/middleware/rails_executor_wrap.rb:13:in `run'
 | /usr/share/gems/gems/dynflow-1.6.10/lib/dynflow/middleware/stack.rb:23:in `call'
 | /usr/share/gems/gems/dynflow-1.6.10/lib/dynflow/middleware/stack.rb:27:in `pass'
 | /usr/share/gems/gems/dynflow-1.6.10/lib/dynflow/middleware.rb:19:in `pass'
 | /usr/share/gems/gems/dynflow-1.6.10/lib/dynflow/action/progress.rb:31:in `with_progress_calculation'
 | /usr/share/gems/gems/dynflow-1.6.10/lib/dynflow/action/progress.rb:17:in `run'
 | /usr/share/gems/gems/dynflow-1.6.10/lib/dynflow/middleware/stack.rb:23:in `call'
 | /usr/share/gems/gems/dynflow-1.6.10/lib/dynflow/middleware/stack.rb:27:in `pass'
 | /usr/share/gems/gems/dynflow-1.6.10/lib/dynflow/middleware.rb:19:in `pass'
 | /usr/share/gems/gems/foreman-tasks-7.2.1/app/lib/actions/middleware/load_setting_values.rb:20:in `run'
 | /usr/share/gems/gems/dynflow-1.6.10/lib/dynflow/middleware/stack.rb:23:in `call'
 | /usr/share/gems/gems/dynflow-1.6.10/lib/dynflow/middleware/stack.rb:27:in `pass'
~~~


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

How reproducible:
N/A

Comment 1 Adam Ruzicka 2023-05-18 14:47:28 UTC
This looks like something that needs to be handled in katello, not in tasks as an engine.

Comment 4 Samir Jha 2023-06-01 14:24:06 UTC
Created redmine issue https://projects.theforeman.org/issues/36461 from this bug

Comment 5 Bryan Kearney 2023-06-14 16:03:15 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/36461 has been resolved.

Comment 7 Vladimír Sedmík 2024-01-23 21:23:33 UTC
Reproduced in 6.13.6, verified in 6.15.0 snap 7.0 - the Remove orphans task succeeded when the file content was disabled on the external capsule and mocked in smart_proxy_mirror_repository.rb.

Comment 10 errata-xmlrpc 2024-04-23 17:11:14 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.15.0 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-2024:2010