Closed (fixed)
Project:
Drush
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Reporter:
Created:
9 Apr 2010 at 01:17 UTC
Updated:
26 Apr 2010 at 03:50 UTC
Jump to comment: Most recent file
Was messing around with an aliases.drushrc.php file and i could not get my site aliases to be reported by sa command until i located that file in my ~/.drush. specifically, neither drupal root nor the active sites folder was sufficient. i don't think my syntax was wrong, since the same file worked fine in my home folder. I'm not sure if drupal root is a valid location; its not listed in the comment at top of example.aliases file. So this bug report is for the sites folder (i was using sites/default in case that matters).
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | aliases-at-root.patch | 3.99 KB | greg.1.anderson |
Comments
Comment #1
greg.1.anderson commentedWell, there's a chicken-and-egg problem here. Aliases are only loaded on-demand, for the most part; the sa command is the notable exception, as it will load all of the alias files it can find. However, alias files for a 'sites' folder are not searched unless that site is bootstrapped, or an alias for that site is mentioned.
For example, I have a file /srv/www/dev.greenknowe.org/sites/greenknowe.org/peer.alias.drushrc.php. It contains:
[Edit: Note that you should not define 'type' in your site alias; it interferes with pm-list. I renamed this to site-type.]
drush sa @peerprints nothing; it cannot find the peer alias.drush @gkdev sa @peeron the other hand will print the above alias definition, because adding "@gkdev" before the command bootstraps to the gkdev site. Similarly,drush rsync @gkdev @peerwill work, because the peer alias will be locatable once the @gkdev alias is referenced.drush rsync @peer @gkdevalso works, because rsync preflights the destination alias (if it can) before it looks for the source alias.The above should also work if you identify your site with -r and -l, or if you cd to your sites folder, but I just tried that and it doesn't work -- so there's your bug. I'll fix it.
Do you think that the drupal root folder should also be added to the alias search location when a site is bootstrapped? That wouldn't be hard to add at the same time.
Comment #2
moshe weitzman commentedYes, I do think the drupal root should be checked for a bootstrapped site. Thats how it worked when aliases were still in the drushrc.php file. Thanks.
Comment #3
greg.1.anderson commentedThis patch fixes the bug described in #1 and also adds the drupal root of any bootstrapped site (or the drupal root specified by a lone -r) as a valid location to find alias files. It also includes the /path/to/root/@sites fix.
Comment #4
moshe weitzman commentedThis did fix my bug. Go ahead and commit when you are satisfied.
Comment #5
greg.1.anderson commentedCommitted.
Comment #6
dman commentedThankyou so so much for this!
I spent too many hours last week trying to restructure my various drush settings files (currently scattered across half a dozen accounts and servers) to deal with the updates that had stopped all my 'local' in-site-folder peer-alias settings from working. Now that the current working site dir is scannable again, my 'peer' configs (or equivalent) Are back in action! *phew*.
From gregs explanation about the boot order I'd seen before, I thought this was going to be a "won't fix"
I also like the look of the new(?) '@self' handle. I see good things happening there. I had to jump through all sorts of hoops to make that work in my own code.
I am happy today!
... now to throw out several pages of work-around code I wrote last week using dir scans and symlinks to get the old behaviour back
:-B