diff options
author | Jay Mundrawala <jdmundrawala@gmail.com> | 2015-03-15 14:28:36 -0700 |
---|---|---|
committer | Jay Mundrawala <jdmundrawala@gmail.com> | 2015-03-20 14:38:49 -0700 |
commit | c71696269ea1865101b1857914f8afdd0a1e7e69 (patch) | |
tree | 9c952b95a7845f49a958dc17e523024a288dc486 /lib/chef/provider/dsc_resource.rb | |
parent | e374b7ba24593c4ffaaf33bca27f623e9f758925 (diff) | |
download | chef-c71696269ea1865101b1857914f8afdd0a1e7e69.tar.gz |
Useful error message when dsc resource is not found
Diffstat (limited to 'lib/chef/provider/dsc_resource.rb')
-rw-r--r-- | lib/chef/provider/dsc_resource.rb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/chef/provider/dsc_resource.rb b/lib/chef/provider/dsc_resource.rb index c9b35fc089..fabb695803 100644 --- a/lib/chef/provider/dsc_resource.rb +++ b/lib/chef/provider/dsc_resource.rb @@ -44,7 +44,7 @@ class Chef def load_current_resource end - + def whyrun_supported? true end @@ -90,13 +90,19 @@ class Chef @converge_description end + def dsc_resource_name + new_resource.resource.to_s + end + def module_name @module_name ||= begin - found = resource_store.find(new_resource.resource.to_s) + found = resource_store.find(dsc_resource_name) r = case found.length when 0 - nil + raise Chef::Exceptions::ResourceNotFound, + "Could not find #{dsc_resource_name}. Check to make "\ + "sure that it shows up when running Get-DscResource" when 1 if found[0]['Module'].nil? :none |