class Chef::ChefFS::FileSystem::DataBagDir
Public Class Methods
new(name, parent, exists = nil)
click to toggle source
Calls superclass method
# File lib/chef/chef_fs/file_system/data_bag_dir.rb, line 28 def initialize(name, parent, exists = nil) super(name, parent, nil, Chef::ChefFS::DataHandler::DataBagItemDataHandler.new) @exists = nil end
Public Instance Methods
delete(recurse)
click to toggle source
# File lib/chef/chef_fs/file_system/data_bag_dir.rb, line 49 def delete(recurse) if !recurse raise NotFoundError.new(self) if !exists? raise MustDeleteRecursivelyError.new(self), "#{path_for_printing} must be deleted recursively" end begin rest.delete(api_path) rescue Timeout::Error => e raise Chef::ChefFS::FileSystem::OperationFailedError.new(:delete, self, e), "Timeout deleting: #{e}" rescue Net::HTTPServerException => e if e.response.code == "404" raise Chef::ChefFS::FileSystem::NotFoundError.new(self, e) else raise Chef::ChefFS::FileSystem::OperationFailedError.new(:delete, self, e), "HTTP error deleting: #{e}" end end end
dir?()
click to toggle source
# File lib/chef/chef_fs/file_system/data_bag_dir.rb, line 33 def dir? exists? end
exists?()
click to toggle source
# File lib/chef/chef_fs/file_system/data_bag_dir.rb, line 42 def exists? if @exists.nil? @exists = parent.children.any? { |child| child.name == name } end @exists end
read()
click to toggle source
# File lib/chef/chef_fs/file_system/data_bag_dir.rb, line 37 def read # This will only be called if dir? is false, which means exists? is false. raise Chef::ChefFS::FileSystem::NotFoundError.new(self) end