From 8f5f95b90db1b9f5fc4a30a9e54ebfd81cce5177 Mon Sep 17 00:00:00 2001 From: Noah Kantrowitz Date: Wed, 2 Mar 2016 17:50:27 -0800 Subject: Clearer exception for loading non-existent data bag items in solo mode. --- lib/chef/data_bag_item.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'lib') 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}") -- cgit v1.2.1