Skip to content

Commit

Permalink
Fixes #38175 - limit errata application to the applicable (#11295)
Browse files Browse the repository at this point in the history
  • Loading branch information
ianballou authored Feb 4, 2025
1 parent 62f5a5c commit 002a543
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/models/katello/concerns/host_managed_extensions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -589,8 +589,8 @@ def deb_names_for_job_template(action:, search:)
end
end

def advisory_ids(search:, check_installable_for_host: true)
errata_scope = check_installable_for_host ? ::Katello::Erratum.installable_for_hosts([self]) : ::Katello::Erratum
def advisory_ids(search:)
errata_scope = ::Katello::Erratum.installable_for_hosts([self])
ids = errata_scope.search_for(search).pluck(:errata_id)
if ids.empty?
fail _("Cannot install errata: No errata found for search term '%s'") % search
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ foreign_input_sets:
exclude: action,package
%>

<% advisory_ids = @host.advisory_ids(search: input("Errata search query"), check_installable_for_host: false) -%>
<% advisory_ids = @host.advisory_ids(search: input("Errata search query")) -%>
<% render_error(N_("No errata matching given search query")) if !input("Errata search query").blank? && advisory_ids.blank? -%>
# RESOLVED_ERRATA_IDS=<%= advisory_ids.join(',') %>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ template_inputs:
required: false
%>

<% advisory_ids = @host.advisory_ids(search: input("Errata search query"), check_installable_for_host: true) -%>
<% advisory_ids = @host.advisory_ids(search: input("Errata search query")) -%>
<% render_error(N_("No errata matching given search query")) if !input("Errata search query").blank? && advisory_ids.blank? -%>
# RESOLVED_ERRATA_IDS=<%= advisory_ids.join(',') %>

Expand Down

0 comments on commit 002a543

Please sign in to comment.