-
Notifications
You must be signed in to change notification settings - Fork 303
Fixes #33525 - Add debs packages_restrict_latest #9671
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -103,8 +103,13 @@ def self.apt_installable_for_host(host) | |
| Katello::Deb.in_repositories(repos).where.not(name: host.installed_debs.pluck(:name)).order(:name) | ||
| end | ||
|
|
||
| def self.latest(_relation) | ||
| fail 'NotImplemented' | ||
| def self.latest(relation) | ||
| # This might be very slow | ||
| return relation.joins( | ||
| "LEFT OUTER JOIN(#{relation.to_sql}) AS katello_debs2 ON " \ | ||
| 'katello_debs.name = katello_debs2.name AND katello_debs.architecture = katello_debs2.architecture AND ' \ | ||
| 'deb_version_cmp(katello_debs.version, katello_debs2.version) < 0 ' \ | ||
| ).where('katello_debs2.id IS NULL') | ||
|
Comment on lines
+108
to
+112
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Capturing things we talked about live: If I were doing this I'd probably drop the explicit return and used a squiggly heredoc, but that's just personal preference so feel free to ignore.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since most of the code was shamelessly copied over from app/models/katello/rpm.rb, I would keep it that way for being consistent. Eventually, we should think about enforcing a certain style through rubocop. AFAIK Katello's rubocop rules are currently pretty flexible. |
||
| end | ||
| end | ||
| end | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some LLM fun to try avoiding the left outer join: