Bug 2141136

Summary: Orphaned ACSs should be cleaned from smart proxies
Product: Red Hat Satellite Reporter: Ian Ballou <iballou>
Component: Capsule - ContentAssignee: Ian Ballou <iballou>
Status: CLOSED ERRATA QA Contact: Vladimír Sedmík <vsedmik>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.12.0CC: pcreech
Target Milestone: 6.13.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: Environment:
Last Closed: 2023-05-03 13:22:42 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 Ian Ballou 2022-11-08 21:59:08 UTC
If a user has ACSs and they reset their Katello instance, ACSs on smart proxies will no longer be tracked by Katello. We should clean these up during orphan cleanup.

Comment 1 Ian Ballou 2022-11-08 21:59:11 UTC
Created from redmine issue https://projects.theforeman.org/issues/35736

Comment 2 Ian Ballou 2022-11-08 21:59:13 UTC
Upstream bug assigned to None

Comment 3 Bryan Kearney 2022-11-09 00:03:41 UTC
Upstream bug assigned to iballou

Comment 4 Bryan Kearney 2022-11-09 00:03:43 UTC
Upstream bug assigned to iballou

Comment 6 Bryan Kearney 2022-11-15 00:03:48 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/35736 has been resolved.

Comment 7 Vladimír Sedmík 2023-01-26 21:15:24 UTC
Verified in 6.13.0 snap 8.0

Steps to verify:
1. Create an ACS with an external Capsule assigned and check it's on the Capsule:
[root@sat]# pulp --profile caps rpm acs list
[
  {
    "pulp_href": "/pulp/api/v3/acs/rpm/rpm/5c6e04d0-6df2-4b1a-a658-efbfdd1bd1e9/",
    "pulp_created": "2023-01-19T15:30:08.282052Z",
    "name": "Custom_yum_ACS-https://capsule.redhat.com:9090-3850",
    "last_refreshed": "2023-01-22T23:00:54.515117Z",
    "paths": [
      "rpm-zchunk/"
    ],
    "remote": "/pulp/api/v3/remotes/rpm/rpm/0d113e8f-c9d4-4875-88a6-a45d0273c468/"
  },
  {
    "pulp_href": "/pulp/api/v3/acs/rpm/rpm/5a065588-3f22-44f6-abfd-3b8eb75df418/",
    "pulp_created": "2023-01-17T20:25:45.669783Z",
    "name": "RHUI_appstream_only-https://capsule.redhat.com:9090-276",
    "last_refreshed": "2023-01-22T23:00:53.291200Z",
    "paths": [
      "content/dist/rhel8/rhui/8/x86_64/appstream/os/"
    ],
    "remote": "/pulp/api/v3/remotes/rpm/rpm/41243107-f9a4-4b33-a97a-5cc71906976c/"
  }
]

2. Run orphan cleanup on the Capsule and check the ACS remained on the Capsule:
[root@sat]# foreman-rake katello:delete_orphaned_content RAILS_ENV=production SMART_PROXY_ID=2
[root@sat]# pulp --profile caps rpm acs list

3. Reset the Satellite (satellite-installer --reset-data) and register the Capsule again.

4. Run orphan cleanup on the Capsule and check the ACS is gone:
[root@sat]# foreman-rake katello:delete_orphaned_content RAILS_ENV=production SMART_PROXY_ID=2
[root@sat]# pulp --profile caps rpm acs list
[]

5. Check the remotes are gone too:
[root@sat ~]# pulp --profile caps show --href /pulp/api/v3/remotes/rpm/rpm/0d113e8f-c9d4-4875-88a6-a45d0273c468/
Error: {"detail":"Not found."}
[root@sat ~]# pulp --profile caps show --href /pulp/api/v3/remotes/rpm/rpm/41243107-f9a4-4b33-a97a-5cc71906976c/
Error: {"detail":"Not found."}

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