Bug #32582
closedUnable to delete Red Hat repository due to "bad" root repo data from older Katello
Description
Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1932486
Description of problem:
Unable to delete a Red Hat Repository
Version-Release number of selected component (if applicable):
Katello 3.18 tested, but likely affects anything Katello 3.15 and above due to https://projects.theforeman.org/issues/28644
How reproducible:
Consistently
Steps to Reproduce:
1) Have a repo-set (::Katello::Content) where the content_url has an actual arch in it instead of $basearch
2) Try to disable the repository tied to that repo-set
Actual results:
Could not disable repository:
Repository not found
Expected results:
The repository is deleted.
Additional info:
Here is the pertinent configuration from my Katello 3.18
root@sat6 ~]# hammer repository-set available-repositories --product-id 282 --id 7446 --organization-id 1
--------------------------------------------------------------|---------|--------
NAME | RELEASE | ENABLED
--------------------------------------------------------------|---------|--------
Red Hat Enterprise Linux 8 for x86_64 - AppStream (Kickstart) | 8.3 | yes
Red Hat Enterprise Linux 8 for x86_64 - AppStream (Kickstart) | 8.2 | no
Red Hat Enterprise Linux 8 for x86_64 - AppStream (Kickstart) | 8.1 | no
Red Hat Enterprise Linux 8 for x86_64 - AppStream (Kickstart) | 8.0 | no
--------------------------------------------------------------|---------|--------
[root@sat6 ~]# hammer repository-set info --product-id 282 --id 7446 --organization-id 1
ID: 7446
Name: Red Hat Enterprise Linux 8 for x86_64 - AppStream (Kickstart)
Type: kickstart
URL: /content/dist/rhel8/$releasever/x86_64/appstream/kickstart
GPG Key: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
Label: rhel-8-for-x86_64-appstream-kickstart
Enabled Repositories:
1) ID: 1486
Name: Red Hat Enterprise Linux 8 for x86_64 - AppStream Kickstart 8.3
2) ID: 1020
Name: Red Hat Enterprise Linux 8 for x86_64 - AppStream Kickstart x86_64 8
[root@sat6 ~]# hammer repository-set available-repositories --product-id 282 --id 7421 --organization-id 1
-----------------------------------------------------------|---------|--------
NAME | RELEASE | ENABLED
-----------------------------------------------------------|---------|--------
Red Hat Enterprise Linux 8 for x86_64 - BaseOS (Kickstart) | 8.3 | yes
Red Hat Enterprise Linux 8 for x86_64 - BaseOS (Kickstart) | 8.2 | no
Red Hat Enterprise Linux 8 for x86_64 - BaseOS (Kickstart) | 8.1 | no
Red Hat Enterprise Linux 8 for x86_64 - BaseOS (Kickstart) | 8.0 | no
-----------------------------------------------------------|---------|--------
[root@sat6 ~]# hammer repository-set info --product-id 282 --id 7421 --organization-id 1
ID: 7421
Name: Red Hat Enterprise Linux 8 for x86_64 - BaseOS (Kickstart)
Type: kickstart
URL: /content/dist/rhel8/$releasever/x86_64/baseos/kickstart
GPG Key: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
Label: rhel-8-for-x86_64-baseos-kickstart
Enabled Repositories:
1) ID: 1018
Name: Red Hat Enterprise Linux 8 for x86_64 - BaseOS Kickstart x86_64 8
2) ID: 1487
Name: Red Hat Enterprise Linux 8 for x86_64 - BaseOS Kickstart 8.3
[root@sat6 ~]# hammer repository-set disable --basearch x86_64 --id 7446 --product-id 282 --organization "Default Organization" --releasever 8
Could not disable repository:
Repository not found
[root@sat6 ~]# hammer repository-set disable --basearch x86_64 --id 7421 --product-id 282 --organization "Default Organization" --releasever 8
Could not disable repository:
Repository not found
[root@sat6 ~]#
I believe this is due to the release version "8" repositories no longer being listed in the manifest.
Updated by Ian Ballou over 3 years ago
- Subject changed from Unable to delete Red Hat repository not in manifest from Katello to Unable to delete Red Hat repository when repo-set's content_url has an actual arch
Updated by Ian Ballou over 3 years ago
In the reporting user's case, the repo-set tied to the Red Hat repo has a content url of `"/content/dist/rhel8/$releasever/x86_64/appstream/os"`. This is causing the basearch to be filtered out of the substitutions used by the repository_mapper: https://github.com/Katello/katello/blob/master/app/models/katello/candlepin/repository_mapper.rb#L73
I'm not sure why there is an arch in the url instead of $basearch, but it shouldn't stop users from disabling the repo.
Updated by Justin Sherrill over 3 years ago
- Target version set to Katello 4.0.1
- Triaged changed from No to Yes
Updated by Ian Ballou over 3 years ago
- Subject changed from Unable to delete Red Hat repository when repo-set's content_url has an actual arch to Unable to delete Red Hat repository due to "bad" root repo data from older Katello
Updated by Ian Ballou over 3 years ago
After some digging, the real issue started with the addition of this and related code: https://github.com/Katello/katello/blob/master/app/models/katello/candlepin/repository_mapper.rb#L73
After the change, all Red Hat root repositories whose repo-sets' content_urls did not have $basearch would be assigned an architecture of "noarch". Before the change, these root repos could have an architecture of "x86_64", for example. We likely need a migration that can find these root repositories and change their architectures to "noarch".
Updated by The Foreman Bot over 3 years ago
- Status changed from New to Ready For Testing
- Pull request https://github.com/Katello/katello/pull/9360 added
Updated by James Jeffers over 3 years ago
- Target version changed from Katello 4.0.1 to Katello 4.0.2
Updated by The Foreman Bot over 3 years ago
- Fixed in Releases Katello 4.2.0 added
Updated by Anonymous over 3 years ago
- Status changed from Ready For Testing to Closed
Applied in changeset katello|f59a6cb35080bd735b795bd36daae094826ee654.