class ChefFS::FileSystem::DataBagDir
Public Class Methods
new(name, parent, exists = nil)
click to toggle source
Calls superclass method
# File lib/chef_fs/file_system/data_bag_dir.rb, line 27 def initialize(name, parent, exists = nil) super(name, parent, nil, ChefFS::DataHandler::DataBagItemDataHandler.new) @exists = nil end
Public Instance Methods
delete(recurse)
click to toggle source
# File lib/chef_fs/file_system/data_bag_dir.rb, line 48 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_rest(api_path) rescue Timeout::Error => e raise ChefFS::FileSystem::OperationFailedError.new(:delete, self, e), "Timeout deleting: #{e}" rescue Net::HTTPServerException => e if e.response.code == "404" raise ChefFS::FileSystem::NotFoundError.new(self, e) else raise ChefFS::FileSystem::OperationFailedError.new(:delete, self, e), "HTTP error deleting: #{e}" end end end
dir?()
click to toggle source
# File lib/chef_fs/file_system/data_bag_dir.rb, line 32 def dir? exists? end
exists?()
click to toggle source
# File lib/chef_fs/file_system/data_bag_dir.rb, line 41 def exists? if @exists.nil? @exists = parent.children.any? { |child| child.name == name } end @exists end
read()
click to toggle source
# File lib/chef_fs/file_system/data_bag_dir.rb, line 36 def read # This will only be called if dir? is false, which means exists? is false. raise ChefFS::FileSystem::NotFoundError.new(self) end