diff options
author | John Keiser <john@johnkeiser.com> | 2015-07-15 12:59:17 -0600 |
---|---|---|
committer | John Keiser <john@johnkeiser.com> | 2015-07-15 12:59:17 -0600 |
commit | 9a3e6e04f3bb39c2b2f5749719f0c21dd3f3f2ec (patch) | |
tree | 10d13791a8744ab02891ee1160e5dd9f72b1b12b /lib/chef/resource.rb | |
parent | 2c98a7b90507b2479ffda8ccd31bd464b1f5bee0 (diff) | |
download | chef-9a3e6e04f3bb39c2b2f5749719f0c21dd3f3f2ec.tar.gz |
Fix issue where DSL is not emitted if state_properties happens before propertyjk/state_attrs
If you call state_properties :x, and there is no
property :x yet, it assumes you are working with a custom
getter/setter like "def x". This is fine, but when you say
"property :x", it won't override that (and will treat the
property as if the getter/setter were already defined instead
of creating a new one).
Diffstat (limited to 'lib/chef/resource.rb')
-rw-r--r-- | lib/chef/resource.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/chef/resource.rb b/lib/chef/resource.rb index ac6f5e8923..dca0033409 100644 --- a/lib/chef/resource.rb +++ b/lib/chef/resource.rb @@ -779,6 +779,7 @@ class Chef def self.property(name, type=NOT_PASSED, **options) name = name.to_sym + options[:instance_variable_name] = :"@#{name}" if !options.has_key?(:instance_variable_name) options.merge!(name: name, declared_in: self) if type == NOT_PASSED @@ -1002,8 +1003,8 @@ class Chef end end - # If state_attrs *excludes* something which is currently part of the - # identity, mark it as identity: false. + # If identity_properties *excludes* something which is currently part of + # the identity, mark it as identity: false. properties.each do |name,property| if property.identity? && !names.include?(name) self.property name, identity: false |