Bug #26981
closed/katello/api/repository_sets/:id returns too many repositories
Description
Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1712811
Description of problem:
When calling the /katello/api/repository_sets/:id API endpoint, Katello (in 6.5) will return every version/copy of a repository when it is published to multiple contentviews/environments:
GET /katello/api/repository_sets/2456
[DEBUG] Params: {
"organization_id" => 3
}
[DEBUG] Headers: {
:params => {
"organization_id" => 3
}
}
[DEBUG] Response: {
"enabled" => true,
"product" => {
"id" => 9,
"name" => "Red Hat Enterprise Linux Server"
},
"repositories" => [
[ 0] {
"id" => 86206,
"name" => "Red Hat Enterprise Linux 7 Server RPMs x86_64 7Server",
"arch" => "x86_64",
"releasever" => "7Server"
},
[ 1] {
"id" => 86216,
"name" => "Red Hat Enterprise Linux 7 Server RPMs x86_64 7Server",
"arch" => "x86_64",
"releasever" => "7Server"
},
…
[1544] {
"id" => 23549,
"name" => "Red Hat Enterprise Linux 7 Server RPMs x86_64 7Server",
"arch" => "x86_64",
"releasever" => "7Server"
},
[1545] {
"id" => 1,
"name" => "Red Hat Enterprise Linux 7 Server RPMs x86_64 7Server",
"arch" => "x86_64",
"releasever" => "7Server"
}
],
"name" => "Red Hat Enterprise Linux 7 Server (RPMs)",
"vendor" => "Red Hat",
"label" => "rhel-7-server-rpms",
"id" => "2456",
"type" => "yum",
"gpgUrl" => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release",
"contentUrl" => "/content/dist/rhel/server/7/$releasever/$basearch/os"
}
In 6.4, the response only lists the "real" repository:
[DEBUG 2019-05-22T09:35:50 API] Params: {}
[DEBUG 2019-05-22T09:35:50 API] Headers: {
:params => {}
}
[DEBUG 2019-05-22T09:35:50 API] Response: {
"enabled" => false,
"product" => {
"id" => 23,
"name" => "Red Hat Ansible Engine"
},
"repositories" => [
[0] {
"id" => 1,
"name" => "Red Hat Ansible Engine 2.6 RPMs for Red Hat Enterprise Linux 7 Server x86_64",
"arch" => "x86_64",
"releasever" => nil
}
],
"name" => "Red Hat Ansible Engine 2.6 RPMs for Red Hat Enterprise Linux 7 Server",
"vendor" => "Red Hat",
"label" => "rhel-7-server-ansible-2.6-rpms",
"id" => "7387",
"type" => "yum",
"gpgUrl" => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release",
"contentUrl" => "/content/dist/rhel/server/7/7Server/$basearch/ansible/2.6/os"
}
This "breaks" Foreman Ansible Modules/Nailgun as Nailgun will query repository information for each of the 1545 repositories listed, which takes a lot of time
How reproducible:
Steps to Reproduce:
1.
2.
3.
Actual results:
Expected results:
Additional info: