-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Eliminate missing constant errors for LWRP class #5000
Conversation
That was already a class method I think, so this is probably creating a global. If that's the goal (and you'll need a hell of a justification if thats the case) it should be |
I think this is a viable fix @coderanger. This PR aims to fix a backwards compatibility issue when using custom providers written under chef ( < 12.4) and running them under version 12.4 and greater. Lets say you have a
The problem today is that the So using a class variable ensures that the variable fed the deprecated constants and later accessed is the same object. Using |
@PrajaktaPurohit I think if you rebase against master you will get the fixes to the dsc_script merged earlier today and perhaps turn this green. |
@mwrock My issue is that the module gets used via |
gotcha @coderanger. I think technically |
Right, I think the change we want is to call |
perhaps. currently the Note this is pushing the envelope of my familiarity with ruby internals and usage patterns which is a super awesome learning experience but excuse me as I spew forth words that come from shallow knowledge. |
This ( |
Ping @lamont-granquist @jkeiser to check that I'm not totally mis-remembering everything, which is never impossible. |
0760143
to
e5bcbaa
Compare
I think another rebase should green-up travis now @PrajaktaPurohit |
e5bcbaa
to
16b0014
Compare
43d9d0b
to
24a201c
Compare
So the thing that feels weird to me now is the Perhaps another route would be to have the deprecated_constant related methods pulled out of the module alltogether and placed directly in the class. This mirrors what is done in Thoughts @coderanger ? |
24a201c
to
fd87dc1
Compare
@mwrock We've gone pretty far in removing |
👍 on the recent change to whack the module which gets rid of the |
Those new methods need very clear comments on them so we know what to remove in Chef 13, that's why they were in a module in the first place. 👎 |
If we do put them in a module lets do it on both sides. So maybe I'm just being overly anal on the use of the class from inside the module where is is used. Anyone else? I don't want to over think this. |
The reason for the module is to make life easier in Chef 13, so we can easily remove the code. @jkeiser has used that pattern in a lot of places now. |
that sounds reasonable and I'd assume we'd want to the removal on both sides. |
fd87dc1
to
7c38923
Compare
@PrajaktaPurohit put the module back and replicated in |
@mwrock already done! |
oh sorry @PrajaktaPurohit , that wasn't intended to sound like a command(yuck) but simply restating what you had done. Thanks so much! |
def deprecated_constants | ||
raise "Deprecated constants should be called only on Chef::Provider" unless self == Chef::Provider |
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.
This needs an exception type. We should probably enable a RuboCop check for this :)
One minor note about exception types if we want to care about this, if we don't do it now it will probably get fixed later when we enable that cop :) 👍 🚢 |
http://manhattan.ci.chef.co/job/chef-trigger-ad_hoc/28/downstreambuildview/