summaryrefslogtreecommitdiff
path: root/lib/chef/chef_fs/file_system/base_fs_object.rb
diff options
context:
space:
mode:
authorjkeiser <jkeiser@opscode.com>2013-01-15 23:11:55 -0800
committerJohn Keiser <jkeiser@opscode.com>2013-06-07 13:12:19 -0700
commitc3e6d026a5c80f16f61bd4c21993a7185640f707 (patch)
tree7c8202e1af7a8be78ae71028a9d26d04f70ff1bc /lib/chef/chef_fs/file_system/base_fs_object.rb
parent1f7699afbb0dd76c33aa81304cf0e57bf65f312d (diff)
downloadchef-c3e6d026a5c80f16f61bd4c21993a7185640f707.tar.gz
Add delete spec, make error printing more consistent
Diffstat (limited to 'lib/chef/chef_fs/file_system/base_fs_object.rb')
-rw-r--r--lib/chef/chef_fs/file_system/base_fs_object.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/chef/chef_fs/file_system/base_fs_object.rb b/lib/chef/chef_fs/file_system/base_fs_object.rb
index 3fbb0c939a..2c4df79614 100644
--- a/lib/chef/chef_fs/file_system/base_fs_object.rb
+++ b/lib/chef/chef_fs/file_system/base_fs_object.rb
@@ -118,14 +118,14 @@ class Chef
# file_contents. This is used for knife upload /cookbooks/cookbookname.
def create_child(name, file_contents)
raise NotFoundError, "Nonexistent #{path_for_printing}" if !exists?
- raise OperationNotAllowedError.new(:create_child), "#{path_for_printing} cannot have a child created under it."
+ raise OperationNotAllowedError.new(:create_child, self)
end
# Delete this item, possibly recursively. Entries MUST NOT delete a
# directory unless recurse is true.
def delete(recurse)
raise NotFoundError, "Nonexistent #{path_for_printing}" if !exists?
- raise OperationNotAllowedError.new(:delete), "#{path_for_printing} cannot be deleted."
+ raise OperationNotAllowedError.new(:delete, self)
end
# Ask whether this entry is a directory. If not, it is a file.
@@ -160,13 +160,13 @@ class Chef
# Read the contents of this file entry.
def read
raise NotFoundError, "Nonexistent #{path_for_printing}" if !exists?
- raise OperationNotAllowedError.new(:read), "#{path_for_printing} cannot be read."
+ raise OperationNotAllowedError.new(:read, self)
end
# Write the contents of this file entry.
def write(file_contents)
raise NotFoundError, "Nonexistent #{path_for_printing}" if !exists?
- raise OperationNotAllowedError.new(:write), "#{path_for_printing} cannot be updated."
+ raise OperationNotAllowedError.new(:write, self)
end
# Important directory attributes: name, parent, path, root