diff options
Diffstat (limited to 'lib/chef/chef_fs/file_system/data_bags_dir.rb')
-rw-r--r-- | lib/chef/chef_fs/file_system/data_bags_dir.rb | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/chef/chef_fs/file_system/data_bags_dir.rb b/lib/chef/chef_fs/file_system/data_bags_dir.rb index 6d9794c726..1cb61bbd1a 100644 --- a/lib/chef/chef_fs/file_system/data_bags_dir.rb +++ b/lib/chef/chef_fs/file_system/data_bags_dir.rb @@ -27,16 +27,14 @@ class Chef super("data_bags", parent, "data") end - def child(name) + def make_child_entry(name, exists = false) result = @children.select { |child| child.name == name }.first if @children - result || super + result || DataBagDir.new(name, self, exists) end def children begin - @children ||= root.get_json(api_path).keys.sort.map do |entry| - DataBagDir.new(entry, self, true) - end + @children ||= root.get_json(api_path).keys.sort.map { |entry| make_child_entry(entry, true) } rescue Timeout::Error => e raise Chef::ChefFS::FileSystem::OperationFailedError.new(:children, self, e), "Timeout getting children: #{e}" rescue Net::HTTPServerException => e |