From a0fd7401f11b54d36e65e6038f3e8dc9d92a8675 Mon Sep 17 00:00:00 2001 From: Ian Ballou Date: Thu, 3 Aug 2023 18:23:41 +0000 Subject: [PATCH] Fixes #36587 - rename Host - Applicable Errata report * ...and fix comment typos --- ...errata.erb => host_-_available_errata.erb} | 4 ++-- .../host_-_registered_content_hosts.erb | 2 +- ...ename_applicable_errata_report_template.rb | 20 +++++++++++++++++++ 3 files changed, 23 insertions(+), 3 deletions(-) rename app/views/unattended/report_templates/{host_-_applicable_errata.erb => host_-_available_errata.erb} (97%) create mode 100644 db/migrate/20230803180552_rename_applicable_errata_report_template.rb diff --git a/app/views/unattended/report_templates/host_-_applicable_errata.erb b/app/views/unattended/report_templates/host_-_available_errata.erb similarity index 97% rename from app/views/unattended/report_templates/host_-_applicable_errata.erb rename to app/views/unattended/report_templates/host_-_available_errata.erb index 86f9b63805c..ca47bdd1bab 100644 --- a/app/views/unattended/report_templates/host_-_applicable_errata.erb +++ b/app/views/unattended/report_templates/host_-_available_errata.erb @@ -1,5 +1,5 @@ <%# -name: Host - Applicable Errata +name: Host - Available Errata snippet: false template_inputs: - name: Hosts filter @@ -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') %> diff --git a/app/views/unattended/report_templates/host_-_registered_content_hosts.erb b/app/views/unattended/report_templates/host_-_registered_content_hosts.erb index 01685edf9cc..aeea7534f43 100644 --- a/app/views/unattended/report_templates/host_-_registered_content_hosts.erb +++ b/app/views/unattended/report_templates/host_-_registered_content_hosts.erb @@ -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' -%> diff --git a/db/migrate/20230803180552_rename_applicable_errata_report_template.rb b/db/migrate/20230803180552_rename_applicable_errata_report_template.rb new file mode 100644 index 00000000000..a0c6c0b7b8d --- /dev/null +++ b/db/migrate/20230803180552_rename_applicable_errata_report_template.rb @@ -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