diff options
author | John Keiser <john@johnkeiser.com> | 2015-12-10 14:36:11 -0800 |
---|---|---|
committer | John Keiser <john@johnkeiser.com> | 2015-12-10 14:55:20 -0800 |
commit | a924c7fa610e1e00c0343e5d81d511fbad8fa541 (patch) | |
tree | a11ce0e3ac3daa5fcd41da74bcff3844d0205dcc /lib/chef/property.rb | |
parent | 1910740592068982a4b6f9ee58452375d60281d5 (diff) | |
download | chef-a924c7fa610e1e00c0343e5d81d511fbad8fa541.tar.gz |
Improve commentsjk/warn-dup-property
Diffstat (limited to 'lib/chef/property.rb')
-rw-r--r-- | lib/chef/property.rb | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/lib/chef/property.rb b/lib/chef/property.rb index 9aaa49c313..2c7cde8651 100644 --- a/lib/chef/property.rb +++ b/lib/chef/property.rb @@ -292,9 +292,21 @@ class Chef value else - # If we are still compiling this resource (rather than running an action - # on it), reading this property before it's been set is likely the wrong - # thing. Warn if it's a duplicate of the enclosing provider. + # If the user does something like this: + # + # ``` + # class MyResource < Chef::Resource + # property :content + # action :create do + # file '/x.txt' do + # content content + # end + # end + # end + # ``` + # + # It won't do what they expect. This checks whether you try to *read* + # `content` while we are compiling the resource. if resource.respond_to?(:enclosing_provider) && resource.enclosing_provider && !resource.currently_running_action && !name_property? && |