Skip to content

Commit

Permalink
Fixes #36587 - rename Host - Applicable Errata report
Browse files Browse the repository at this point in the history
* ...and fix comment typos
  • Loading branch information
ianballou committed Aug 7, 2023
1 parent 7c41286 commit 75d8ea3
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<%#
name: Host - Applicable Errata
name: Host - Available Errata
snippet: false
template_inputs:
- name: Hosts filter
Expand Down Expand Up @@ -27,7 +27,7 @@ template_inputs:
model: ReportTemplate
require:
- plugin: katello
version: 4.9.0
version: 4.9.0
-%>
<%- report_headers 'Host', 'Operating System', 'Environment', 'Erratum', 'Type', 'Published', 'Available since', 'Severity', 'Packages', 'CVEs', 'Reboot suggested' -%>
<%- errata_filter = input('Errata filter') %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ template_inputs:
model: ReportTemplate
require:
- plugin: katello
version: 4.9.0
version: 4.9.0
-%>
<%- if input('Installability') == 'applicable' -%>
<%- report_headers 'Name', 'Ip', 'Operating System', 'Subscriptions', 'Applicable Errata', 'Owner', 'Kernel', 'Latest kernel available' -%>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
class RenameApplicableErrataReportTemplate < ActiveRecord::Migration[6.1]
TEMPLATE_NAMES = {
"Host - Applicable Errata" => "Host - Available Errata",
}

def up
TEMPLATE_NAMES.each do |from, to|
token = SecureRandom.base64(5)
ReportTemplate.unscoped.find_by(name: to)&.update_columns(:name => "#{to} Backup #{token}")
ReportTemplate.unscoped.find_by(name: from)&.update_columns(:name => to)
end
end

def down
TEMPLATE_NAMES.each do |from, to|
ReportTemplate.unscoped.find_by(name: from)&.delete
ReportTemplate.unscoped.find_by(name: to)&.update_columns(:name => from)
end
end
end

0 comments on commit 75d8ea3

Please sign in to comment.