cool tech graphics

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

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})
Date posted: April 9, 2013

Comments

Thank you for the post, you saved me some time!

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <cpp>, <java>, <php>. The supported tag styles are: <foo>, [foo].
  • Web page addresses and email addresses turn into links automatically.
  • Lines and paragraphs break automatically.

Metal Toad is an Advanced AWS Consulting Partner. Learn more about our AWS Managed Services

Schedule a Free Consultation

Speak with our team to understand how Metal Toad can help you drive innovation, growth, and success.