diff options
author | Jay Mundrawala <jdmundrawala@gmail.com> | 2015-01-13 10:25:00 -0800 |
---|---|---|
committer | Jay Mundrawala <jdmundrawala@gmail.com> | 2015-01-13 10:25:00 -0800 |
commit | 8b2b41fb537317bcfb1e0e439f66ad466084f8f5 (patch) | |
tree | 4b0b0601d7a7979b9bf0ec771c8ea5bd7b330df1 | |
parent | 15f36de72cc63e8ee986d15fc0db4f0736e3cb1b (diff) | |
download | chef-8b2b41fb537317bcfb1e0e439f66ad466084f8f5.tar.gz |
Provide more info when cookbook metadata is not found
-rw-r--r-- | lib/chef/exceptions.rb | 8 | ||||
-rw-r--r-- | lib/chef/knife/cookbook_site_install.rb | 2 |
2 files changed, 7 insertions, 3 deletions
diff --git a/lib/chef/exceptions.rb b/lib/chef/exceptions.rb index b949e7b975..18b8ee5d3f 100644 --- a/lib/chef/exceptions.rb +++ b/lib/chef/exceptions.rb @@ -152,8 +152,12 @@ class Chef class MetadataNotValid < StandardError; end class MetadataNotFound < StandardError - def initialize - super "No metadata.rb or metadata.json!" + attr_reader :install_path + attr_reader :cookbook_name + def initialize(install_path, cookbook_name) + @install_path = install_path + @cookbook_name = cookbook_name + super "No metadata.rb or metadata.json found for cookbook #{@cookbook_name} in #{@install_path}" end end diff --git a/lib/chef/knife/cookbook_site_install.rb b/lib/chef/knife/cookbook_site_install.rb index edf8dd14f0..d0ab6da3ef 100644 --- a/lib/chef/knife/cookbook_site_install.rb +++ b/lib/chef/knife/cookbook_site_install.rb @@ -181,7 +181,7 @@ class Chef return md end - raise Chef::Exceptions::MetadataNotFound + raise Chef::Exceptions::MetadataNotFound.new(@install_path, @cookbook_name) end end end |