diff options
author | John Keiser <john@johnkeiser.com> | 2015-09-25 12:21:50 -0700 |
---|---|---|
committer | John Keiser <john@johnkeiser.com> | 2015-09-25 12:22:19 -0700 |
commit | ff54a6dd7ef781f242f1ab5b513f90a76902f5b8 (patch) | |
tree | 2ecd802b1c4fb535c6a5eb3d1808959baf6266fe /lib/chef/property.rb | |
parent | af422456552b8a64cb3ea90167a0f80f401790cf (diff) | |
download | chef-ff54a6dd7ef781f242f1ab5b513f90a76902f5b8.tar.gz |
Don't treat name_property/attribute as defaults if they are false
Diffstat (limited to 'lib/chef/property.rb')
-rw-r--r-- | lib/chef/property.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/chef/property.rb b/lib/chef/property.rb index 011ff93aef..d699f16a9d 100644 --- a/lib/chef/property.rb +++ b/lib/chef/property.rb @@ -89,7 +89,11 @@ class Chef # Only pick the first of :default, :name_property and :name_attribute if # more than one is specified. - found_defaults = options.keys.select { |k| [ :default, :name_attribute, :name_property ].include?(k) } + found_defaults = options.keys.select do |k| + # Only treat name_property or name_attribute as a default if they are `true` + k == :default || + ((k == :name_property || k == :name_attribute) && options[k]) + end if found_defaults.size > 1 preferred_default = found_defaults[0] # We do *not* prefer `default: nil` even if it's first, because earlier |