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 #10635 - Formalize deprecation warning #2444
Conversation
There were the following issues with the commit message:
Guidelines are available on the Foreman wiki. This message was auto-generated by Foreman's prprocessor |
@@ -15,7 +15,7 @@ def mail(headers = {}, &block) | |||
|
|||
class GroupMail | |||
def initialize(emails) | |||
ActiveSupport::Deprecation.warn 'GroupMail will be removed as mailers should not generate multiple messages, use MailNotification#deliver' | |||
ForemanDeprecation.deprecation_warning("MailNotification","deliver","1.10.0","GroupMail will be removed as mailers should not generate multiple messages") |
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.
Same comment on all of these changes - code without spacing around arguments is hard to read, please include it as standard.
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.
fixing.
2015-06-09 15:09 GMT+03:00 Dominic Cleal notifications@github.com:
In app/mailers/application_mailer.rb
#2444 (comment):@@ -15,7 +15,7 @@ def mail(headers = {}, &block)
class GroupMail
def initialize(emails)
ActiveSupport::Deprecation.warn 'GroupMail will be removed as mailers should not generate multiple messages, use MailNotification#deliver'
ForemanDeprecation.deprecation_warning("MailNotification","deliver","1.10.0","GroupMail will be removed as mailers should not generate multiple messages")
Same comment on all of these changes - code without spacing around
arguments is hard to read, please include it as standard.—
Reply to this email directly or view it on GitHub
https://github.com/theforeman/foreman/pull/2444/files#r32005809.
class Deprecation | ||
#aviliable options: controller, method, general info, callstack | ||
def self.deprecation_warning(foreman_version_deadline, options={}) | ||
raise Foreman::Exception, _("Invalid version format, please enter in x.y.z") unless foreman_version_deadline.to_s.match(/\A^\d[.]\d+[.]\d$\z/) |
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.
@domcleal I tried using Gem:Version.correct? and it wasn't strict enough (e.g 1.2.e was accepted).
So I decided sticking with the Reg ex.
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.
Hm okay, not sure that matters a lot.
- The regexp now contains both \A and ^, ditto for EOL, just use one or the other.
@@ -12,17 +12,17 @@ class SmartProxy < ActiveRecord::Base | |||
#TODO check if there is a way to look into the tftp_id too | |||
# maybe with a predefined sql | |||
has_and_belongs_to_many :features | |||
has_many :subnets, :foreign_key => 'dhcp_id' |
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 don't re-format files like this, revert changes that aren't to do with this PR.
Unit tests are failing due to ForemanDeprecation usage, and rubocop is also failing - possibly because of the reformatting, please revert those and run |
The author of your commit is set as @elobato according to GitHub, is that deliberate? |
It was by mistake, fixed it. |
Looks good. Just scanning for other deprecation warnings when rebased onto develop, I see:
Could you update those too please? |
Added them. |
@@ -2,6 +2,7 @@ module Deprecations | |||
def const_missing(const_name) | |||
return(super) unless const_name.to_s == 'ConfigTemplate' | |||
warn '`ConfigTemplate` has been deprecated. Use `ProvisioningTemplate` instead.' |
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.
And remove this to stop a duplicate warning?
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 forgot :).
Merged as 319d1ff for Foreman 1.9, thanks @alongoldboim. |
I have added Foreman::Deprecation service which wraps ActiveSupport::Deprecation that we are currently using, formalizing the messages and enforces deprecation.
I have changed all the deprecations calls on the core to the new format and placed a default
two versions up (1.10.0) as a deadline(all deprecations with 1.10.0 will be deleted on it's release).