summaryrefslogtreecommitdiff
path: root/lib/chef/property.rb
diff options
context:
space:
mode:
authorJohn Keiser <john@johnkeiser.com>2015-09-29 14:09:03 -0700
committerJohn Keiser <john@johnkeiser.com>2015-09-29 16:00:57 -0700
commita5780a9a67efb8ccd82b5007fdb2c2e7c582d295 (patch)
treebc577510bea7dfdbe2854a76dc61da7184e4dea9 /lib/chef/property.rb
parentbc82c3e8603f6908d80fc29beb1d0902563398e7 (diff)
downloadchef-a5780a9a67efb8ccd82b5007fdb2c2e7c582d295.tar.gz
Make sure name_attribute works on derived propertiesjk/name-attribute-dup
Diffstat (limited to 'lib/chef/property.rb')
-rw-r--r--lib/chef/property.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/chef/property.rb b/lib/chef/property.rb
index 2b151b350a..b8d8005655 100644
--- a/lib/chef/property.rb
+++ b/lib/chef/property.rb
@@ -422,7 +422,13 @@ class Chef
# @return [Property] The new property type.
#
def derive(**modified_options)
- Property.new(**options.merge(**modified_options))
+ # Since name_property and name_attribute are aliases, if you specify either
+ # one in modified_options it overrides anything in original options.
+ options = self.options
+ if modified_options.has_key?(:name_property) || modified_options.has_key?(:name_attribute)
+ options = options.reject { |k,v| k == :name_attribute || k == :name_property }
+ end
+ Property.new(options.merge(modified_options))
end
#