summaryrefslogtreecommitdiff
path: root/lib/chef/resource/registry_key.rb
diff options
context:
space:
mode:
authorPrajaktaPurohit <prajakta@opscode.com>2012-11-20 14:57:50 -0800
committerLamont Granquist <lamont@opscode.com>2012-12-19 15:54:40 -0800
commit73774b5c8758dba3a7c0f6ff9f2fe6c595a34aec (patch)
treecb2c678255d974979bfdf941c3552aae957dcc12 /lib/chef/resource/registry_key.rb
parenta2a19ee3a85d5a266f2a2b91072612bfaa5b2dd8 (diff)
downloadchef-73774b5c8758dba3a7c0f6ff9f2fe6c595a34aec.tar.gz
Adding the registry provider and resource
Diffstat (limited to 'lib/chef/resource/registry_key.rb')
-rw-r--r--lib/chef/resource/registry_key.rb74
1 files changed, 74 insertions, 0 deletions
diff --git a/lib/chef/resource/registry_key.rb b/lib/chef/resource/registry_key.rb
new file mode 100644
index 0000000000..9ba84082d7
--- /dev/null
+++ b/lib/chef/resource/registry_key.rb
@@ -0,0 +1,74 @@
+# Author:: Doug MacEachern (<dougm@vmware.com>)
+# Author:: Seth Chisamore (<schisamo@opscode.com>)
+# Cookbook Name:: windows
+# Resource:: registry
+#
+# Copyright:: 2010, VMware, Inc.
+# Copyright:: 2011, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+require 'chef/provider/registry_key'
+require 'chef/resource'
+
+class Chef
+ class Resource
+ class RegistryKey < Chef::Resource
+
+ identity_attr :key_name
+ state_attrs :values, :type
+
+ def initialize(name, run_context=nil)
+ super
+ @resource_name = :registry_key
+ #@action = :modify
+ @architecture = :machine
+ @recursive = true
+ @key_name = name
+ @allowed_actions.push(:create, :create_if_missing, :delete, :delete_key)
+ #@provider = Chef::Provider::RegistryKey
+ end
+
+ def key(arg=nil)
+ set_or_return(
+ :key,
+ arg,
+ :kind_of => String,
+ :name_attribute => true
+ )
+ end
+ def values(arg=nil)
+ set_or_return(
+ :values,
+ arg,
+ :kind_of => Array
+ )
+ end
+ def recursive(arg=nil)
+ set_or_return(
+ :recursive,
+ arg,
+ :kind_of => Boolean,
+ )
+ end
+ def architecture(arg=nil)
+ set_or_return(
+ :architecture,
+ arg,
+ :kind_of => Symbol
+ )
+ end
+
+ end
+ end
+end