Skip to content

Commit

Permalink
Fixes #36075 - improve errata installation templates (Katello#10444)
Browse files Browse the repository at this point in the history
Co-authored-by: Jeremy Lenz <[email protected]>

(cherry picked from commit c9c15fa)
  • Loading branch information
sbernhard authored and quba42 committed Aug 21, 2023
1 parent 40ad573 commit 2d46e46
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 17 deletions.
8 changes: 4 additions & 4 deletions app/views/foreman/job_templates/install_errata.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ foreign_input_sets:
exclude: action,package
%>
<% if @host.operatingsystem.family == 'Suse' -%>
<% advisories = input(:errata).split(',').join(' ') %>
<% advisories = input(:errata).split(',').join(' ') -%>
<%= render_template('Package Action - Script Default', :action => 'install -n -t patch', :package => advisories) %>
<% else %>
<% advisories = input(:errata).split(',').map { |e| "--advisory=#{e}" }.join(' ') %>
<% else -%>
<% advisories = input(:errata).split(',').map { |e| "--advisory=#{e}" }.join(' ') -%>
<%= render_template('Package Action - Script Default', :action => 'update-minimal', :package => advisories) %>
<% end %>
<% end -%>
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,9 @@ kind: job_template
%>

<% if @host.operatingsystem.family == 'Suse' -%>
<% advisories = input(:errata).split(',').join(' ') -%>
<%= render_template('Run Command - Ansible Default', :command => "zypper -n install -t patch #{advisories}") -%>
<% elsif @host.operatingsystem.family == 'Debian' -%>
<% advisories = input(:errata).split(',').map { |e| @host.debs_for_erratum(e) }.join(' ') -%>
<%= render_template('Run Command - Ansible Default', :command => "apt-get -o Dpkg::Options::=\"--force-confdef\" -o Dpkg::Options::=\"--force-confold\" -y --only-upgrade install -y #{advisories}") %>
<% advisories = input(:errata).split(',').join(' ') -%>
<%= render_template('Run Command - Ansible Default', :command => "zypper -n install -t patch #{advisories}") %>
<% else -%>
<% advisories = input(:errata).split(',').map { |e| "--advisory=#{e}" }.join(' ') -%>
<%= render_template('Run Command - Ansible Default', :command => "yum -y update-minimal #{advisories}") -%>
<% advisories = input(:errata).split(',').map { |e| "--advisory=#{e}" }.join(' ') -%>
<%= render_template('Run Command - Ansible Default', :command => "yum -y update-minimal #{advisories}") %>
<% end -%>
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,13 @@ foreign_input_sets:
exclude: action,package
%>

<% advisory_ids = @host.advisory_ids(search: input("Errata search query")) %>
<% 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(',') %>

<% if @host.operatingsystem.family == 'Suse' -%>
<%= render_template('Package Action - Script Default', :action => 'install -n -t patch', :package => advisory_ids.join(' ')) %>
<% else %>
<% raise "No errata matching given search query" if !input("Errata search query").blank? && advisory_ids.empty? %>

<% advisories = advisory_ids.map { |e| "--advisory=#{e}" }.join(' ') %>
<% else -%>
<% advisories = advisory_ids.map { |e| "--advisory=#{e}" }.join(' ') -%>
<%= render_template('Package Action - Script Default', :action => 'update-minimal', :package => advisories) %>
<% end %>
<% end -%>

0 comments on commit 2d46e46

Please sign in to comment.