diff options
author | Tim Smith <tsmith@chef.io> | 2018-04-27 15:38:59 -0700 |
---|---|---|
committer | Tim Smith <tsmith@chef.io> | 2018-04-27 15:38:59 -0700 |
commit | 011a0a5f6cf68a563781643b16601f6276a51fba (patch) | |
tree | a578112c19234995c3e37028dcdb509a70b9befd | |
parent | a068d3cde6105a591da24d1a5ff35bde26c16214 (diff) | |
download | chef-011a0a5f6cf68a563781643b16601f6276a51fba.tar.gz |
Convert :key property in registry_key to use propertyregistry_key
Convert this to a true property. It required updating the specs a tiny bit since key gets returned as a state value now (as it should).
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r-- | lib/chef/resource/registry_key.rb | 10 | ||||
-rw-r--r-- | spec/unit/resource/registry_key_spec.rb | 2 |
2 files changed, 2 insertions, 10 deletions
diff --git a/lib/chef/resource/registry_key.rb b/lib/chef/resource/registry_key.rb index 1ae3f81492..84abb98699 100644 --- a/lib/chef/resource/registry_key.rb +++ b/lib/chef/resource/registry_key.rb @@ -28,7 +28,6 @@ class Chef description "Use the registry_key resource to create and delete registry keys in Microsoft Windows." introduced "11.0" - identity_attr :key state_attrs :values default_action :create @@ -67,17 +66,10 @@ class Chef def initialize(name, run_context = nil) super - @key = name @values, @unscrubbed_values = [], [] end - def key(arg = nil) - set_or_return( - :key, - arg, - :kind_of => String - ) - end + property :key, String, name_property: true, identity: true def values(arg = nil) if not arg.nil? diff --git a/spec/unit/resource/registry_key_spec.rb b/spec/unit/resource/registry_key_spec.rb index d8eea74ed4..1f32a00210 100644 --- a/spec/unit/resource/registry_key_spec.rb +++ b/spec/unit/resource/registry_key_spec.rb @@ -195,6 +195,6 @@ describe Chef::Resource::RegistryKey, "state" do it "returns scrubbed values" do resource.values([ { :name => "poosh", :type => :binary, :data => 255.chr * 1 } ]) - expect(resource.state_for_resource_reporter).to eql( { :values => [{ :name => "poosh", :type => :binary, :data => "a8100ae6aa1940d0b663bb31cd466142ebbdbd5187131b92d93818987832eb89" }] } ) + expect(resource.state_for_resource_reporter[:values]).to eql( [{ :name => "poosh", :type => :binary, :data => "a8100ae6aa1940d0b663bb31cd466142ebbdbd5187131b92d93818987832eb89" }] ) end end |