-
Notifications
You must be signed in to change notification settings - Fork 898
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix notification missing substituted values, log deprecation if other places do this #20978
Fix notification missing substituted values, log deprecation if other places do this #20978
Conversation
app/models/notification.rb
Outdated
# 1. Deprecate now | ||
# 2. Fail validation going forward via errors.add(error_args) | ||
error_args = [:options, "text bindings for notification_type: '#{notification_type.name}' failed with error: '#{e.message}' with options: '#{options.inspect}' and message #{notification_type.message.inspect}. Next release will not allow a notification without complete bindings."] | ||
ActiveSupport::Deprecation.warn("#{error_args.join(' ')}", caller_locations[1..-1].reject {|location| location.label.include?("emit_for_event")}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note, emit_for_event
above is the primary caller where notifications get created indirectly if the event has a matching notification_type
when you raise an event so we have to skip it as a possible caller
since that's not where you need to fix the code to provide a complete event, including the full_data
containing the values to substitute. It's complicated, but that's how it works currently.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would vote to put some sort of comment in the code directly about it then so the reasoning isn't lost to time.
…y_exceeded event Fixes ManageIQ#20977
Fixes ManageIQ#20977 Fixes warnings of the variety: DEPRECATION WARNING: options text bindings for notification_type: automate_service_provisioned failed with error: 'key{subject} not found' with options: '{}' and message "Service %{subject} has been provisioned.". Next release will not allow a notification without complete bindings. (called from block (3 levels) in <top (required)> at /Users/joerafaniello/Code/manageiq/spec/models/notification_spec.rb:14) DEPRECATION WARNING: options text bindings for notification_type: automate_service_provisioned failed with error: 'key{subject} not found' with options: '{}' and message "Service %{subject} has been provisioned.". Next release will not allow a notification without complete bindings. (called from block (3 levels) in <top (required)> at /Users/joerafaniello/Code/manageiq/spec/models/notification_spec.rb:15) DEPRECATION WARNING: options text bindings for notification_type: service_retired failed with error: 'key{subject} not found' with options: '{}' and message "Service %{subject} has been retired.". Next release will not allow a notification without complete bindings. (called from block (3 levels) in <top (required)> at /Users/joerafaniello/Code/manageiq/spec/models/notification_spec.rb:16) DEPRECATION WARNING: options text bindings for notification_type: automate_tenant_info failed with error: 'key{message} not found' with options: '{}' and message "%{message}". Next release will not allow a notification without complete bindings. (called from block (5 levels) in <top (required)> at /Users/joerafaniello/Code/manageiq/spec/models/notification_spec.rb:98)
5fecc07
to
8e87dc4
Compare
Checked commits jrafanie/manageiq@62847b3~...8e87dc4 with ruby 2.6.3, rubocop 0.82.0, haml-lint 0.35.0, and yamllint app/models/notification.rb
|
…tituted_values Fix notification missing substituted values, log deprecation if other places do this (cherry picked from commit cac4c50)
Kasparov backport details:
|
Fixes #20977
https://talk.manageiq.org/t/how-can-i-solve-this-issue-the-server-name-memory-usage-memory-usage-exceeded-limit-memory-threshold-the-server-process-pid-exited-and-will-be-restarted/5261
cc @djberg96 @himdel (thanks Martin for the deep dive)