class Chef::ChefFS::FileSystem::ChefServer::CookbookArtifactsDir
def upload_cookbook(other, options)
to make this work. So instead, we make a temporary cookbook
Cookbook Version uploader also requires a lot of refactoring
Knife currently does not understand versioned cookbooks
def upload_cookbook(other, options) cookbook_name, _, identifier = other.name.rpartition("-") Dir.mktmpdir do |temp_cookbooks_path| proxy_cookbook_path = "#{temp_cookbooks_path}/#{cookbook_name}" # Make a symlink file_class.symlink other.file_path, proxy_cookbook_path # Instantiate a proxy loader using the temporary symlink proxy_loader = Chef::Cookbook::CookbookVersionLoader.new(proxy_cookbook_path, other.chefignore) proxy_loader.load! cookbook_to_upload = proxy_loader.cookbook_version cookbook_to_upload.identifier = identifier cookbook_to_upload.freeze_version if options[:freeze] # Instantiate a new uploader based on the proxy loader uploader = Chef::CookbookUploader.new(cookbook_to_upload, force: options[:force], rest: chef_rest, policy_mode: true) with_actual_cookbooks_dir(temp_cookbooks_path) do uploader.upload_cookbooks end # # When the temporary directory is being deleted on # windows, the contents of the symlink under that # directory is also deleted. So explicitly remove # the symlink without removing the original contents if we # are running on windows # if ChefUtils.windows? Dir.rmdir proxy_cookbook_path end end end