Delete orphaned content task failing

Problem:
When trying to delete orphaned content of of the tasks fail and gets stuck in state paused.

[root@bdapmgmtprd01 ~]# foreman-rake katello:delete_orphaned_content
Orphaned content deletion started in background.
[root@bdapmgmtprd01 ~]# hammer --no-headers --output json task list  --order 'started_at DESC' --search 'state = "paused" '
[
  {
    "ID": "298d73e8-2bd7-4a7c-8752-9f9a2d543a2f",
    "Action": "Remove orphans ",
    "State": "paused",
    "Result": "error",
    "Started at": "2022-08-24 10:54:12 UTC",
    "Ended at": null,
    "Duration": "00:03:13.669352",
    "Owner": "foreman_admin",
    "Task errors": [
      "(\"Cannot delete some instances of model 'Repository' because they are referenced through protected foreign keys: 'Addon.repository', 'RpmRepository.repository_ptr'.\", {<Addon: Springdale Various Additional Packages>})"
    ]
  }
]

Expected outcome:
Orphaned content deleted.

Foreman and Proxy versions:
Latest actually.

Foreman 3.3.0-1
Katello 4.5.0-1
Pulp 3.18

Foreman and Proxy plugin versions:
Latest as well.

Distribution and version:
Red Hat Enterprise Linux Server release 7.9 (Maipo)

Other relevant data:
Looks pretty similar to that: Katello 4.3.0: rake katello:delete_orphaned_content error but with different error message.
I even try to modify code according to pull request for this issue Delete Orphaned Content fails but it doesn’t help.

We may have a fix for this here:

Would you mind trying and if it does not solve the issue, please try to dig up the actual failed pulp task and report an issue with pulp_rpm.
Thank you in advance!

I agree that this ought to be fixed now, @dj_kill were you able to resolve htis?

Yes.
Patch works fine. Thanks!

1 Like