summaryrefslogtreecommitdiff
path: root/lib/chef/win32/registry.rb
diff options
context:
space:
mode:
authorPrajaktaPurohit <prajakta@opscode.com>2012-11-21 17:41:51 -0800
committerLamont Granquist <lamont@opscode.com>2012-12-19 15:54:41 -0800
commit8124fd3ec15fac2ed071eb1174c69cc265833e2e (patch)
tree9750e12a32ddfebbfa3c5bd8b98f30f1a75944f9 /lib/chef/win32/registry.rb
parentb140c97c10914dc34dca8373a0fe2b79acb0b398 (diff)
downloadchef-8124fd3ec15fac2ed071eb1174c69cc265833e2e.tar.gz
Making some private functions public
Diffstat (limited to 'lib/chef/win32/registry.rb')
-rw-r--r--lib/chef/win32/registry.rb58
1 files changed, 29 insertions, 29 deletions
diff --git a/lib/chef/win32/registry.rb b/lib/chef/win32/registry.rb
index 617d892449..2a8eac0dfb 100644
--- a/lib/chef/win32/registry.rb
+++ b/lib/chef/win32/registry.rb
@@ -232,6 +232,34 @@ class Chef
return false
end
+ def value_exists!(key_path, value)
+ unless value_exists?(key_path, value)
+ raise Chef::Exceptions::Win32RegValueMissing, "Registry key #{key_path} has no value named #{value[:name]}"
+ end
+ end
+
+ def type_matches?(key_path, value)
+ value_exists!(key_path, value)
+ hive, key = get_hive_and_key(key_path)
+ hive.open(key) do |reg|
+ reg.each do |val_name, val_type|
+ if val_name == value[:name]
+ type_new = get_type_from_name(value[:type])
+ if val_type == type_new
+ return true
+ end
+ end
+ end
+ end
+ return false
+ end
+
+ def type_matches!(key_path, value)
+ unless type_matches?(key_path, value)
+ raise Chef::Exceptions::Win32RegTypesMismatch, "Registry key #{key_path} has a value #{value[:name]} with a type that is not #{value[:type]}"
+ end
+ end
+
private
def node
@@ -266,37 +294,9 @@ class Chef
return hive, key
end
- def value_exists!(key_path, value)
- unless value_exists?(key_path, value)
- raise Chef::Exceptions::Win32RegValueMissing, "Registry key #{key_path} has no value named #{value[:name]}"
- end
- end
-
- def type_matches?(key_path, value)
- value_exists!(key_path, value)
- hive, key = get_hive_and_key(key_path)
- hive.open(key, ::Win32::Registry::KEY_READ | registry_system_architecture) do |reg|
- reg.each do |val_name, val_type|
- if val_name == value[:name]
- type_new = get_type_from_name(value[:type])
- if val_type == type_new
- return true
- end
- end
- end
- end
- return false
- end
-
- def type_matches!(key_path, value)
- unless type_matches?(key_path, value)
- raise Chef::Exceptions::Win32RegTypesMismatch, "Registry key #{key_path} has a value #{value[:name]} with a type that is not #{value[:type]}"
- end
- end
-
def get_type_from_name(val_type)
value = {
- :binary || 1 => ::Win32::Registry::REG_BINARY,
+ :binary => ::Win32::Registry::REG_BINARY,
:string => ::Win32::Registry::REG_SZ,
:multi_string => ::Win32::Registry::REG_MULTI_SZ,
:expand_string => ::Win32::Registry::REG_EXPAND_SZ,