Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #36430 - Get arch restriction data from all repos, not just those with URL #10581

Merged

Conversation

jeremylenz
Copy link
Member

@jeremylenz jeremylenz commented Jun 1, 2023

What are the changes introduced in this pull request?

image

On the Repository Sets tab, the arch restriction label ("x86_64" in the image above) was based on

pc.repositories&.first&.arch

(where pc is a Katello::ProductContent).

pc.repositories runs the query

def repositories
      Katello::Repository.in_default_view.where(:root_id => product.root_repositories.has_url.where(:content_id => content.cp_content_id))
end

Because of the has_url, pc.repositories will not return any repository that doesn't have a URL. So if you have a product with an empty repository, or a repository that doesn't yet have an Upstream URL set, pc.repositories would return [], meaning the arch restriction label would not be properly displayed.

With this change, the query doesn't filter out any repositories, thus allowing a correct arch restriction label in the UI.

Considerations taken when implementing this change?

Originally the new query was using pc.product.root_repositories.first but I realized that would cause an incorrect arch restriction label if you had more than one repo in your product.

What are the testing steps for this pull request?

Create custom products with repos that don't have an upstream URL
Restrict the architecture on one of these repos, but leave the other unrestricted
Verify that the arch restriction label shows up correctly on all custom repos.

@theforeman-bot
Copy link

Issues: #36430

@jeremylenz
Copy link
Member Author

Updated to handle the case where a product has >1 repo.

ready for review

@jeremylenz jeremylenz changed the title Fixes #36430 - Get arch restriction data from product, not repositories Fixes #36430 - Get arch restriction data from root, not repositories Jun 1, 2023
@jeremylenz
Copy link
Member Author

@lfu Updated.

Copy link
Member

@lfu lfu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!

@jeremylenz jeremylenz merged commit 338eb1d into Katello:master Jun 2, 2023
4 of 5 checks passed
@jeremylenz jeremylenz changed the title Fixes #36430 - Get arch restriction data from root, not repositories Fixes #36430 - Get arch restriction data from all repos, not just those with URL Jun 3, 2023
lfu pushed a commit to lfu/katello that referenced this pull request Jun 21, 2023
…atello#10581)

* Fixes #36430 - Get arch restriction data from product, not repositories
  so that arch restriction labels show up properly in RepositorySetsTab

(cherry picked from commit 338eb1d)
lfu pushed a commit that referenced this pull request Jun 21, 2023
…10581)

* Fixes #36430 - Get arch restriction data from product, not repositories
  so that arch restriction labels show up properly in RepositorySetsTab

(cherry picked from commit 338eb1d)
wbclark pushed a commit to wbclark/katello that referenced this pull request Sep 7, 2023
…atello#10581)

* Fixes #36430 - Get arch restriction data from product, not repositories
  so that arch restriction labels show up properly in RepositorySetsTab

(cherry picked from commit 338eb1d)
wbclark pushed a commit that referenced this pull request Sep 27, 2023
…10581)

* Fixes #36430 - Get arch restriction data from product, not repositories
  so that arch restriction labels show up properly in RepositorySetsTab

(cherry picked from commit 338eb1d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants