summaryrefslogtreecommitdiff
path: root/lib/chef
diff options
context:
space:
mode:
authorLamont Granquist <lamont@opscode.com>2012-11-20 14:09:03 -0800
committerLamont Granquist <lamont@opscode.com>2012-12-19 15:54:40 -0800
commitafff142b2502134696e9cefb62a51b086a55f19b (patch)
tree44eefbcc33cf6ac8ec99f7c8320b5662fbd22df7 /lib/chef
parent9fe5f2d9a54db59448e7acea2cf26640b820bc1b (diff)
downloadchef-afff142b2502134696e9cefb62a51b086a55f19b.tar.gz
adding exceptions for missing recursive option
Diffstat (limited to 'lib/chef')
-rw-r--r--lib/chef/exceptions.rb1
-rw-r--r--lib/chef/win32/registry.rb7
2 files changed, 3 insertions, 5 deletions
diff --git a/lib/chef/exceptions.rb b/lib/chef/exceptions.rb
index 3f3d0e6418..09a82c239c 100644
--- a/lib/chef/exceptions.rb
+++ b/lib/chef/exceptions.rb
@@ -135,6 +135,7 @@ class Chef
class Win32RegValueMissing < RuntimeError; end
class Win32RegValueExists < RuntimeError; end
class Win32RegTypesMismatch < RuntimeError; end
+ class Win32RegNoRecursive < ArgumentError; end
class MissingRole < RuntimeError
NULL = Object.new
diff --git a/lib/chef/win32/registry.rb b/lib/chef/win32/registry.rb
index 80b7239a90..406897ded6 100644
--- a/lib/chef/win32/registry.rb
+++ b/lib/chef/win32/registry.rb
@@ -107,9 +107,7 @@ class Chef
Chef::Log.debug("Registry key #{key_path} has missing subkeys, and recursive specified, creating them....")
create_missing(key_path)
else
- Chef::Log.debug("Registry key #{key_path} has missing subkeys, and recursive not specified, doing nothing")
- #XXX: RAISE ERROR?
- return
+ raise Chef::Exceptions::Win32RegNoRecursive, "Registry key #{key_path} has missing subkeys, and recursive not specified"
end
end
if key_exists?(key_path)
@@ -138,8 +136,7 @@ class Chef
reg.delete_key(key_to_delete,recursive)
end
else
- Chef::Log.debug("Registry key #{key_path} has subkeys and recursive not specified, doing nothing")
- # XXX: RAISE ERROR?
+ raise Chef::Exceptions::Win32RegNoRecursive, "Registry key #{key_path} has subkeys, and recursive not specified"
end
else
hive.open(key_parent, ::Win32::Registry::KEY_WRITE | registry_system_architecture) do |reg|