summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2018-03-04 21:45:54 -0800
committerTim Smith <tsmith@chef.io>2018-03-04 21:45:54 -0800
commit5f8a3f4e5ffb372be05c3a5b218fa9392609439d (patch)
tree2871c8d18b5d6a1460b4c7bb865a136e13cc1f47 /lib
parentde4242def44e5a99a55187d122ecf95a0b5a64fc (diff)
downloadchef-5f8a3f4e5ffb372be05c3a5b218fa9392609439d.tar.gz
registry_key: Properly limit allowed values for architecture
Partially modernize registry_key resource. The main fix here is that we limit what symbols can be passed to the architecture property now where as before it was wide open. This will probably help a bit since the docs are a bit confusing and also enormous. Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'lib')
-rw-r--r--lib/chef/resource/registry_key.rb28
1 files changed, 9 insertions, 19 deletions
diff --git a/lib/chef/resource/registry_key.rb b/lib/chef/resource/registry_key.rb
index 565ff278ea..8ca111bf33 100644
--- a/lib/chef/resource/registry_key.rb
+++ b/lib/chef/resource/registry_key.rb
@@ -15,14 +15,19 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-require "chef/provider/registry_key"
+
require "chef/resource"
require "chef/digester"
class Chef
class Resource
- # Use the registry_key resource to create and delete registry keys in Microsoft Windows.
class RegistryKey < Chef::Resource
+ resource_name :registry_key
+ provides :registry_key
+
+ description "Use the registry_key resource to create and delete registry keys in Microsoft Windows."
+ introduced "11.0"
+
identity_attr :key
state_attrs :values
@@ -62,8 +67,6 @@ class Chef
def initialize(name, run_context = nil)
super
- @architecture = :machine
- @recursive = false
@key = name
@values, @unscrubbed_values = [], []
end
@@ -102,21 +105,8 @@ class Chef
end
end
- def recursive(arg = nil)
- set_or_return(
- :recursive,
- arg,
- :kind_of => [TrueClass, FalseClass]
- )
- end
-
- def architecture(arg = nil)
- set_or_return(
- :architecture,
- arg,
- :kind_of => Symbol
- )
- end
+ property :recursive, [TrueClass, FalseClass], default: false
+ property :architecture, Symbol, default: :machine, equal_to: [:machine, :x86_64, :i386]
private