chef / cheffish

Resources and tools for testing and interacting with Chef and Chef Server.
Apache License 2.0
38 stars 28 forks source link

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

Closed adamleff closed 7 years ago

adamleff commented 8 years ago

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.

lamont-granquist commented 8 years ago

👍

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...