Project:Drush Vagrant Integration
Version:7.x-1.0-alpha3
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed (works as designed)

Issue Summary

I've been unable to get this working on my Vagrant installation.
Just wondering what the best way to figure out what is going wrong.
troc
'vagrant ssh' works
'vagrant ssh-config' works

'drush vagrant' works and the output matches that of 'vagrant ssh-config'

but using the alias from the local machine fails

drush @troc-vagrant cc all --verbose
Load alias @troc-vagrant                                                                                   [notice]
Command cache-clear needs a higher bootstrap level to run - you will need invoke drush from a more      [error]
functional Drupal environment to run this command.
The drush command 'cc all' could not be executed.                                                       [error]
The directory /vagrant/public/troc.loc/www does not contain a valid Drupal installation

output for Drush sa

drush sa --full
$aliases['troc-vagrant'] = array (
  'uri' => 'troc.loc',
  'root' => '/vagrant/public/troc.loc/www',
  'remote-host' => '127.0.0.1',
  'remote-user' => 'vagrant',
  'ssh-options' => '-o\'HostName 127.0.0.1\' -o\'Port 2222\' -o\'UserKnownHostsFile /dev/null\' -o\'StrictHostKeyChecking no\' -o\'PasswordAuthentication no\' -o\'IdentityFile /Library/Ruby/Gems/1.8/gems/vagrant-0.8.7/keys/vagrant\' -o\'IdentitiesOnly yes\' ',
);

Any ideas?

Comments

#1

Status:active» closed (works as designed)

Yeah - this is a consequence of Drush's built-in check to see if someone has created a remote alias that should really be local. If 'remote-host' is 127.0.0.1 or localhost, drush will assume that it should not run over SSH. (See http://api.drush.ws/api/function/drush_is_local_host/4.x.)

I also originally ran into this http://drupal.org/node/1323780.

Luckily, the fix is easy: if you change the 'remote-host' => '127.0.0.1' to 'remote-host' => 'default', the '-o\'HostName 127.0.0.1\' will still make SSH connect over the forwarded port on 127.0.0.1