From 4513f5ef8a8905ec94f9623501d6aa69d7196428 Mon Sep 17 00:00:00 2001 From: Samir Jha Date: Thu, 15 Feb 2024 20:03:40 +0000 Subject: [PATCH] Fixes #37170 - Remove Subscription-Entitlement notification --- ...40215193148_remove_subscription_mailer_notification.rb | 7 +++++++ db/seeds.d/106-mail_notifications.rb | 8 -------- lib/katello/scheduled_jobs.rb | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) create mode 100644 db/migrate/20240215193148_remove_subscription_mailer_notification.rb diff --git a/db/migrate/20240215193148_remove_subscription_mailer_notification.rb b/db/migrate/20240215193148_remove_subscription_mailer_notification.rb new file mode 100644 index 00000000000..244a045446e --- /dev/null +++ b/db/migrate/20240215193148_remove_subscription_mailer_notification.rb @@ -0,0 +1,7 @@ +class RemoveSubscriptionMailerNotification < ActiveRecord::Migration[6.1] + def change + subscriptions_expiring_soon_mailer = MailNotification.find_by(name: "subscriptions_expiring_soon") + subscriptions_expiring_soon_mailer&.delete + ForemanTasks::Task.find_by(state: "scheduled", label: "SendExpireSoonNotifications")&.destroy! + end +end diff --git a/db/seeds.d/106-mail_notifications.rb b/db/seeds.d/106-mail_notifications.rb index 95c3300dbfd..919a28637c3 100644 --- a/db/seeds.d/106-mail_notifications.rb +++ b/db/seeds.d/106-mail_notifications.rb @@ -37,14 +37,6 @@ :subscription_type => 'alert' }, - {:name => :subscriptions_expiring_soon, - :description => N_('A list of subscriptions expiring soon'), - :mailer => 'Katello::SubscriptionMailer', - :method => 'subscription_expiry', - :subscription_type => 'report', - :queryable => true - }, - {:name => :repository_sync_failure, :description => N_('A notification about failed repository sync'), :mailer => 'Katello::TaskMailer', diff --git a/lib/katello/scheduled_jobs.rb b/lib/katello/scheduled_jobs.rb index f76819e8d8b..287df11cb81 100644 --- a/lib/katello/scheduled_jobs.rb +++ b/lib/katello/scheduled_jobs.rb @@ -1,6 +1,6 @@ # First, we check if there's a job already enqueued for any notifications ::Foreman::Application.dynflow.config.on_init do |world| - [CreateExpiredManifestNotifications, CreateHostLifecycleExpireSoonNotifications, CreatePulpDiskSpaceNotifications, SendExpireSoonNotifications].each do |job_class| + [CreateExpiredManifestNotifications, CreateHostLifecycleExpireSoonNotifications, CreatePulpDiskSpaceNotifications].each do |job_class| job_class.spawn_if_missing(world) end end