Project

General

Profile

Bug #32582

Unable to delete Red Hat repository due to "bad" root repo data from older Katello

Added by Ian Ballou about 1 year ago. Updated 12 months ago.

Status:
Closed
Priority:
High
Assignee:
Category:
Repositories
Target version:
Difficulty:
Triaged:
Yes
Bugzilla link:
Fixed in Releases:
Found in Releases:
Red Hat JIRA:

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.

Associated revisions

Revision f59a6cb3 (diff)
Added by Ian Ballou 12 months ago

Fixes #32582 - old rh repo root arch stops disabling (#9360)

History

#1 Updated by Ian Ballou about 1 year 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

#2 Updated by Ian Ballou about 1 year 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.

#3 Updated by Justin Sherrill about 1 year ago

  • Triaged changed from No to Yes
  • Target version set to Katello 4.0.1

#4 Updated by Ian Ballou about 1 year 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

#5 Updated by Ian Ballou about 1 year 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".

#6 Updated by The Foreman Bot about 1 year ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/Katello/katello/pull/9360 added

#7 Updated by James Jeffers 12 months ago

  • Target version changed from Katello 4.0.1 to Katello 4.0.2

#8 Updated by The Foreman Bot 12 months ago

  • Fixed in Releases Katello 4.2.0 added

#9 Updated by Anonymous 12 months ago

  • Status changed from Ready For Testing to Closed

Also available in: Atom PDF