summaryrefslogtreecommitdiff
path: root/lib/chef/data_bag_item.rb
diff options
context:
space:
mode:
authorNoah Kantrowitz <noah@coderanger.net>2016-03-02 17:50:27 -0800
committerNoah Kantrowitz <noah@coderanger.net>2016-03-02 17:50:27 -0800
commit8f5f95b90db1b9f5fc4a30a9e54ebfd81cce5177 (patch)
tree6de211e312bfa49eda72faeb641a4d347a2cd441 /lib/chef/data_bag_item.rb
parenta4d98365c1d68d7a24fba62783538951d2bbd2e0 (diff)
downloadchef-8f5f95b90db1b9f5fc4a30a9e54ebfd81cce5177.tar.gz
Clearer exception for loading non-existent data bag items in solo mode.
Diffstat (limited to 'lib/chef/data_bag_item.rb')
-rw-r--r--lib/chef/data_bag_item.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/chef/data_bag_item.rb b/lib/chef/data_bag_item.rb
index 6ac863a47d..4d6e33ce1f 100644
--- a/lib/chef/data_bag_item.rb
+++ b/lib/chef/data_bag_item.rb
@@ -150,6 +150,7 @@ class Chef
def self.load(data_bag, name)
if Chef::Config[:solo]
bag = Chef::DataBag.load(data_bag)
+ raise Exceptions::InvalidDataBagItemID, "Item #{name} not found in data bag #{data_bag}. Other items found: #{bag.keys.join(", ")}" unless bag.include?(name)
item = bag[name]
else
item = Chef::ServerAPI.new(Chef::Config[:chef_server_url]).get("data/#{data_bag}/#{name}")