Drupal

Fixing "no such file" error in Capistrano upload()

Last week, this error brought many of our deployments to a screeching halt. "upload via sftp failed on metaltoad.com: Net::SFTP::StatusException (Net::SFTP::StatusException open ...releases/20130408223054/drupal/ sites/all/themes/boilerplate/css/compiled/default.css (2, "no such file"))".


Filed under:
upload via sftp failed on metaltoad.com: Net::SFTP::StatusException
(Net::SFTP::StatusException open ...releases/20130408223054/drupal/
sites/all/themes/boilerplate/css/compiled/default.css (2, "no such file"))

Last week, this error brought many of our deployments to a screeching halt. The error in question was produced by an upload task intended to compile and deploy Compass assets. It turns out that by default, the FileTransfer::upload() method uses net-sftp. In the past this gem has always created the target directory during a recursive upload. However, starting with version 2.1.x that behavior has changed, and it will not create the target by default.

commit ccf42984
Author: Pablo Merino
Date: Sat Apr 28 11:05:03 2012 +0200

    Added option to create directory on directory upload

Solution

Use the :mkdir option, like this:

upload(from, "#{release_path}/#{theme_path}/css/compiled",
  {:via => :sftp, :mkdir => true})

Similar posts

Get notified on new marketing insights

Be the first to know about new B2B SaaS Marketing insights to build or refine your marketing function with the tools and knowledge of today’s industry.