-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Global Drush9 should redispatch to site-local drush8 even if alias record not found #3274
Comments
Note that the drush-launcher handles this situation just fine, as it hands off to site local drush without trying to handle the site alias. |
Yes, this is a question of priorities. The use-case you describe should work. I think that Drush 9 as a launcher should be a supported feature. |
We got this issue at lagoon now, basically we want to ship always with the newest Drush globally in the docker image installed, but then a client might have a site that is still running with Drush 8 and also want's to use the SiteAliases of Drush 8. We currently work around this issue with installing the newest Version of Drush 8, but that's not the best solution for the future. Would moving the Redispatcher earlier create other issues? |
Have you considered using drush-launcher as your global solution? See
https://github.com/drush-ops/drush-launcher
|
Catching the exception is undesirable, as that would entail an awkward duplication of the redispatch code. Moving the redispatch code earlier works for this failure case, but does not work for other cases (e.g. when using an alias that is found to select a Drupal site that has a site-local Drush). I think that postponing throwing the exception until later will work, if we make it no longer the responsibility of PreflightSiteLocatior::findSite (in the current code -- aliasManager->findSelf above). PR coming. |
…hrough to the site-local Drush.
I merged the PR that should fix this into dev-master, but I don't have a test site with site-local Drush 8 and some site-local aliases. Please confirm this is working now with latest master. |
Confirmed fixed. |
I can easily work around this problem, but I'd like to document it. The request I am making is
drush @bh.dev4 uli
. The exception I get is[preflight] The alias @bh.dev4 could not be found.
.drush/src/Preflight/Preflight.php
Lines 248 to 272 in 8ac98b8
I have a Composer project with drush8 as the site-local Drush. I'm using Drush9 as a global launcher (not recommended, but "happens to work"). I am getting an error at line 261 above. The issue that Drush9 is looking for a self.site.yml file in COMPOSER_ROOT/drush but this site has bh.aliases.drushrc.php. So no alias is found and we get an exception instead of reaching the redispatch in line 272.
Seems like we need to catch the exception, or move the redispatch earlier.
The text was updated successfully, but these errors were encountered: