Skip to content
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

Avoid redefining the Chef::Resource#name method #116

Merged
merged 1 commit into from
Dec 6, 2016

Conversation

adamleff
Copy link
Contributor

@adamleff adamleff commented Dec 5, 2016

In chef/chef#5606, Chef will now log deprecation warnings whenever
a resource defines a property that is already an instance_method
on that resource. If this happens, a user may be inadvertently
causing unexpected and difficult-to-troubleshoot behavior.

A number of the cheffish resources were defining a name property
which is already a property defined on the Chef::Resource base class.
This change stops defining the name property for each of these
resources and instead defines something unique.

In addition, the chef_mirror resource defined a freeze property
which is already an instance_method on Object instances. I have
changed that to be freeze_on_upload and defined a method to log
a deprecation warning while providing backward compatibility.

In chef/chef#5606, Chef will now log deprecation warnings whenever
a resource defines a property that is already an instance_method
on that resource. If this happens, a user may be inadvertently
causing unexpected and difficult-to-troubleshoot behavior.

A number of the cheffish resources were defining a `name` property
which is already a property defined on the Chef::Resource base class.
This change stops defining the `name` property for each of these
resources and instead defines something unique.

In addition, the `chef_mirror` resource defined a `freeze` property
which is already an instance_method on `Object` instances. I have
changed that to be `freeze_on_upload` and defined a method to log
a deprecation warning while providing backward compatibility.

Signed-off-by: Adam Leff <[email protected]>
@adamleff adamleff force-pushed the adamleff/stop_using_name_property branch from 31bf35c to c7d5174 Compare December 5, 2016 20:54
@lamont-granquist
Copy link
Contributor

👍

although now that i see this, i'm suspecting that other users out there may have overloaded the name property to introduce validations.

this is still the right thing to do here and should be merged, but i'm not sure the chef/chef PR should be merged...

@thommay thommay merged commit 9e8b6c6 into master Dec 6, 2016
@thommay thommay removed the Developing label Dec 6, 2016
@adamleff adamleff deleted the adamleff/stop_using_name_property branch December 19, 2016 04:37
@thommay thommay added Improvement Type: Enhancement Adds new functionality. and removed Improvement labels Jan 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Adds new functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants