Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Remote Drush commands from BLT repo root #426

Closed
dpagini opened this issue Sep 19, 2016 · 0 comments
Closed

Remote Drush commands from BLT repo root #426

dpagini opened this issue Sep 19, 2016 · 0 comments
Labels
Enhancement A feature or feature request

Comments

@dpagini
Copy link
Contributor

dpagini commented Sep 19, 2016

I am running into a problem with the /drush.wrapper file. I'm not sure if there's a good way to fix this, but I wanted to bring it up.

So, drush.wrapper will call the vendor/bin/drush.launcher executable and pass in the "-r $DOCROOT" (which is the project/local docroot) for what I can tell is all invocations of the drush command.
The problem I am seeing is that calling $ drush @alias status from my repo root causes me to see the simple output of status, anytime you run it from a non-Drupal directory.

Here are the commands I'm running, from each place, and the output:

  • from /repo/root/ I run $ drush status
    • I get the status of my local site. I believe this is the intended behavior of the drush.wrapper file, to be able to run a drush command from anywhere in the repo.
  • from /repo/root/ I run $ drush @alias status
    • I get the basic drush output, like it can't find the Drupal install. I see 3 PHP variable outputs (php exec, config, os), and 5 drush variable outputs (drush script, version, config, temp directory, alias file). This is what I think is wrong.
  • from /repo/root/docroot I run $ drush status
    • Same as first output.
  • from /repo/root/docroot I run $ drush @alias status
    • Same as first output.

When I run the first two commands with the "-debug" flag, it seems that the remote drush operation is being called with the LOCAL root in the alias example, instead of the remote root that is specified in my alias file. I'm not sure why this would be? Running the same command IN the project docroot lets those values be set correctly, though.

Here is the obfuscated output of the alias commands, first in the repo root, then in the docroot.
Command: /var/www/mysite$ drush @alias status

Calling proc_open(ssh -p 22 [email protected] 'env COLUMNS=124 drush  --config=/var/www/mysite/drush/drushrc.php --alias-path=/var/www/mysite/drush/site-aliases --root=/var/www/mysite/docroot --debug --user --uri=mysite.com --verbose  core-status   --e --g 2>&1' 2>&1);

Command: /var/www/mysite/docroot$ drush @alias status

Calling proc_open(ssh -p 22 [email protected] 'env COLUMNS=124 drush  --debug --user --root=/var/www/html/mysite/docroot --uri=mysite.com --verbose  core-status   --e --g 2>&1' 2>&1);

Notice in this 2nd command that the --root flag is set correctly to the remote docroot.

I hope this makes sense? Please let me know if I can clarify anything here...? Is this a necessary evil, or is there anything I can try to work around this?

@dpagini dpagini changed the title Remote Drush commands Remote Drush commands from blt repo root Sep 19, 2016
@dpagini dpagini changed the title Remote Drush commands from blt repo root Remote Drush commands from BLT repo root Sep 19, 2016
steveworley added a commit to steveworley/blt that referenced this issue Sep 22, 2016
This fixes acquia#426.

By removing the directory detection and passthrough we remove the ability to run `drush` commands from the BLT project root and this will now need to be run from the `docroot` directory. However this allows Drush to correctly infer the `root` from defined aliases so if you set up a local drush alias you can still run `drush @local` from the BLT project root.

This fixed issues I was having with running remote drush commands and I don't think it's necessary to detect and pass in the root directory with the `-r` option.

This is working with global and local drush installs, ie.

```
./drush.wrapper @Local status
./drush.wrapper @dev status
```

and

```
drush @Local status
drush @dev status
```
grasmash pushed a commit that referenced this issue Sep 23, 2016
This fixes #426.

By removing the directory detection and passthrough we remove the ability to run `drush` commands from the BLT project root and this will now need to be run from the `docroot` directory. However this allows Drush to correctly infer the `root` from defined aliases so if you set up a local drush alias you can still run `drush @local` from the BLT project root.

This fixed issues I was having with running remote drush commands and I don't think it's necessary to detect and pass in the root directory with the `-r` option.

This is working with global and local drush installs, ie.

```
./drush.wrapper @Local status
./drush.wrapper @dev status
```

and

```
drush @Local status
drush @dev status
```
@grasmash grasmash added the Enhancement A feature or feature request label Sep 27, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Enhancement A feature or feature request
Projects
None yet
Development

No branches or pull requests

2 participants