-
Notifications
You must be signed in to change notification settings - Fork 983
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #30929 - Deprecate ovirt v3 API
- Loading branch information
Showing
2 changed files
with
33 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,28 @@ | ||
ActiveSupport::Deprecation.behavior = :silence if Rails.env.production? | ||
|
||
Foreman::Application.configure do |app| | ||
config.after_initialize do | ||
next if Foreman.in_rake? | ||
next unless Rails.env.production? | ||
next unless ComputeResource.all.unscoped.where(type: 'Foreman::Model::Ovirt').any? { |cr| cr.use_v4 == false } | ||
blueprint = NotificationBlueprint.find_by_name('feature_deprecation') | ||
next unless blueprint | ||
message = UINotifications::StringParser.new(blueprint.message, {feature: 'Ovirt V3 API', version: '2.4'}).to_s | ||
next if blueprint.notifications.where(message: message).any? | ||
Notification.create!( | ||
audience: Notification::AUDIENCE_ADMIN, | ||
message: message, | ||
notification_blueprint: blueprint, | ||
initiator: User.anonymous_admin, | ||
actions: { | ||
links: [ | ||
{ | ||
href: 'https://community.theforeman.org/t/suggestion-to-drop-ovirt-api-v3-from-foreman/19915', | ||
title: _('Further Information'), | ||
external: true, | ||
}, | ||
], | ||
} | ||
) | ||
end | ||
end |