Method: Chef::ChefFS::FileSystem::BaseFSObject#create_child

Defined in:
lib/chef/chef_fs/file_system/base_fs_object.rb

#create_child(name, file_contents) ⇒ Object

Create a child of this entry with the given name and contents. If contents is nil, create a directory.

NOTE: create_child_from is an optional method that can also be added to your entry class, and will be called without actually reading the file_contents. This is used for knife upload /cookbooks/cookbookname.

Raises:



129
130
131
132
133
# File 'lib/chef/chef_fs/file_system/base_fs_object.rb', line 129

def create_child(name, file_contents)
  raise NotFoundError.new(self) unless exists?

  raise OperationNotAllowedError.new(:create_child, self)
end