summaryrefslogtreecommitdiff
path: root/lib/chef/chef_fs/chef_fs_data_store.rb
diff options
context:
space:
mode:
authorJohn Keiser <jkeiser@opscode.com>2014-04-21 19:06:26 -0700
committerJohn Keiser <jkeiser@opscode.com>2014-04-21 19:06:26 -0700
commit5bb8dfcbcca5c1d7416087cc9e4df367f83ae497 (patch)
tree9ce034044b58d6f0487bd2eedded0248cac93db7 /lib/chef/chef_fs/chef_fs_data_store.rb
parent33fb088fc4eea851800721cc7685fb2d0bbd0f10 (diff)
downloadchef-5bb8dfcbcca5c1d7416087cc9e4df367f83ae497.tar.gz
Raise exception from /cookbooks/NAME if cookbook does not exist
(and versioned_cookbooks is on)
Diffstat (limited to 'lib/chef/chef_fs/chef_fs_data_store.rb')
-rw-r--r--lib/chef/chef_fs/chef_fs_data_store.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/chef/chef_fs/chef_fs_data_store.rb b/lib/chef/chef_fs/chef_fs_data_store.rb
index f174c32acf..6ccf12bd56 100644
--- a/lib/chef/chef_fs/chef_fs_data_store.rb
+++ b/lib/chef/chef_fs/chef_fs_data_store.rb
@@ -203,12 +203,16 @@ class Chef
elsif path[0] == 'cookbooks' && path.length == 2
if Chef::Config.versioned_cookbooks
- with_entry([ 'cookbooks' ]) do |entry|
+ result = with_entry([ 'cookbooks' ]) do |entry|
# list /cookbooks/name = filter /cookbooks/name-version down to name
entry.children.map { |child| split_name_version(child.name) }.
select { |name, version| name == path[1] }.
map { |name, version| version }
end
+ if result == []
+ raise ChefZero::DataStore::DataNotFoundError.new(path)
+ end
+ result
else
# list /cookbooks/name = <single version>
version = get_single_cookbook_version(path)