-
Notifications
You must be signed in to change notification settings - Fork 991
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
Fixes #27442 - deprecation mysql warning #6938
Conversation
Issues: #27442 |
This points to a non-existing blogpost: theforeman/theforeman.org#1404 |
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.
config/application.rb
Outdated
def notify_deprecations | ||
if ActiveRecord::Base.connection.adapter_name.downcase.starts_with?('mysql') | ||
blueprint = NotificationBlueprint.find_by_name('feature_deprecation') | ||
Foreman::Deprecation.deprecation_warning('1.24', "Support for MySQL is deprecated, migrate to PostgreSQL") |
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.
there was a discussion to postpone this by one version, is it 1.24 now then?
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.
Yeah, changing to 1.25.
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.
The implementation looks quite good. I would move it to separate file, though...
config/application.rb
Outdated
@@ -343,6 +344,30 @@ def init_dynflow | |||
def setup_auditing | |||
Audit.send(:include, AuditSearch) | |||
end | |||
|
|||
def notify_deprecations |
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.
wouldn't it be better to have a sepparate config/initializers/<i.e. depracate_mysql.rb>
file?
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.
Yes, we actually have an existing deprecations.rb
initializer, so moving it there.
I'll be ok with pulling this in post branching, and would prefer to properly review the migration instructions and blog post not on the same day as branching. I think also 1.25 is more reasonable so users have enough time to prepare and for us to test the migration, and i'll comment to that effect on the discourse thread. |
ack, I won't touch it :-) |
Incorporated all comments, rebased, fixed bug when blueprint was not present (database was not yet seeded). I am using "1.25/2.0" in the notification text, however I keep "1.25" in |
a0961f5
to
bd0aea4
Compare
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 hate rockets (=>
) 🚀
Otherwise LGTM 👍
Mysql tests are failing, i guess because of the deprecation warning - we need to add it to the whitelist |
bd0aea4
to
4d26e27
Compare
Removed 2.0, added to the whitelist, rebased. |
config/initializers/deprecations.rb
Outdated
Foreman::Deprecation.deprecation_warning('1.25', "Support for MySQL is deprecated, please migrate to PostgreSQL") | ||
blueprint = NotificationBlueprint.find_by_name('feature_deprecation') | ||
return unless blueprint | ||
message = UINotifications::StringParser.new(blueprint.message, {feature: 'MySQL as a backend database', version: '1.25'}).to_s |
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.
Other notifications got its classes and define theirs initialize
, if we want to have a generick deprecation class, wouldn't it great to have such class, which would encapsulate these?
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.
Sorry what? ;-) Can you provide an example code?
config/initializers/deprecations.rb
Outdated
:actions => { | ||
:links => [ | ||
{ | ||
:href => 'https://theforeman.org/2019/08/dropping-support-for-mysql.html', |
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.
We'll need to update this once we get the post published.
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.
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.
please update the link and rebase on latest develop, otherwise gtg
config/initializers/deprecations.rb
Outdated
:actions => { | ||
:links => [ | ||
{ | ||
:href => 'https://theforeman.org/2019/08/dropping-support-for-mysql.html', |
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.
Done. |
4d26e27
to
61c2eee
Compare
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.
Thanks @lzap ! just installed mysql to verify and this works well.
config/as_deprecation_whitelist.yaml
Outdated
@@ -14,3 +14,6 @@ | |||
# https://projects.theforeman.org/issues/23300 | |||
- message: 'Dangerous query method (method whose arguments are used as raw SQL) called | |||
with non-attribute argument(s):' | |||
|
|||
# https://projects.theforeman.org/issues/27035 | |||
- message: 'Support for MySQL is deprecated, migrate to PostgreSQL' |
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.
Looks like this only works inside tests? mysql tests are failing to run with:
/usr/local/rvm/gems/ruby-2.5.1@test_develop_pr_core-3/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:69:in block in execute_hook': DEPRECATION WARNING: You are using a deprecated behavior, it will be removed in version 1.25, Support for MySQL is deprecated, please migrate to PostgreSQL (called from <top (required)> at /home/jenkins/workspace/test_develop_pr_core/database/mysql/ruby/2.5/slave/fast/config/environment.rb:5) (ActiveSupport::DeprecationException)
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.
The full message is needed, try:
# https://projects.theforeman.org/issues/27035
- message: 'You are using a deprecated behavior, it will be removed in version 1.25,
Support for MySQL is deprecated, migrate to PostgreSQL'
61c2eee
to
53a0708
Compare
Rebased. |
sadly looks like that doesn't work - it is still failing on mysql with |
53a0708
to
6a0cfcc
Compare
Removed, should be good now. |
Unrelated - weird failure? Cannot see it. |
6a0cfcc
to
4706356
Compare
All right rebased now hopefully for the last time. |
4706356
to
2f522f7
Compare
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.
Thanks @lzap ! test failure unrelated
1.23 - 2c7aa44 |
A notification that warns about MySQL in a non-intrusive way similarly that we did for deprecated settings about a year ago.
Edit: Based off: https://github.com/theforeman/foreman/pull/6038/files