drush-ops / drush

Drush is a command-line shell and scripting interface for Drupal, a veritable Swiss Army knife designed to make life easier for those who spend their working hours hacking away at the command prompt.
https://www.drush.org
2.33k stars 1.08k forks source link

Could not find the alias @self #2195

Closed ElijahLynn closed 5 years ago

ElijahLynn commented 8 years ago

8.1.2

While in a multisite directory with the settings.php for that site, I run drush site-aliases and a @self is listed. If I then do a drush site-aliases @self I get some output with a root and URI (name of sites/sitename folder). If I then do a any operation on @self such as drush @self status I get a Could not find the alias @self.

frederickjh commented 8 years ago

Hi!

Am seeing this too on Drush Version 7.3.0. I set result-file option for sql-dump in the sites alias file.

Then from the webroot I run the following commands:

drush --debug @self sql-dump Outputs the @sitealias info drush --debug @sitealias sql-dump Exact same output as above drush --debug sql-dump Results in the database dump being sent to the screen drush --debug @meosd7site.dev sql-dump Successful dump to the defined result-file drush --debug @self sql-dump Gives the Error Could not find the alias @self

Drush preflight prepare loaded autoloader at                         [preflight]
/root/.composer/vendor/autoload.php [0.01 sec, 2.18 MB]
Starting Drush preflight. [0.01 sec, 2.18 MB]                                                                                                                     [preflight]
Loading drushrc "/root/.drush/drushrc.php" into "home.drush" scope. [0.01 sec, 2.18 MB]                                                                           [bootstrap]
Cache HIT cid: 7.3.0-commandfiles-0-81cc86c1995ab7206f383ec28ad43baf [0.02 sec, 2.25 MB]                                                                              [debug]
Loading drushrc "/var/www/sites/all/drush/drushrc.php" into "drupal" scope. [0.08 sec, 6.23 MB]                                                                   [bootstrap]
Could not find the alias @self [0.1 sec, 6.23 MB]                                                                                                                 [error]

So it appears that the drush sa command is able to get the site alias @self but drush sql-dump cannot. I guess the question is why?

God Bless! Frederick

q0rban commented 7 years ago

Also seeing this with drush 8.1.5.

q0rban commented 7 years ago
$ drush sa | grep @self
@self
$ drush @self sa
Could not find the alias @self            [error]
richardbporter commented 7 years ago

I've got this issue as well with Drush 8.1.8. Did anyone find out why this was happening? Any related issues?

dman-coders commented 7 years ago

Drush Version : 8.1.12 Same sort of issue as reported.

I'm using a DrupalVM, and operating on a Drupal7 site.

From gregs answer at https://drupal.stackexchange.com/a/109144/4266

In order to use the @self alias, Drush must be able to detect and bootstrap your Drupal site

I finally got the clue. I had an empty (not yet installed) site, with an empty database provided in settings.php. I was trying to

drush sql-sync @project.prod @self

to do a clean start, BUT although @self was present (it showed up in site-alias) but not bootstrapping, the sql-sync command failed with that message.

My work-around for kicking off a sql-sync into an empty site shell is now to use the alternative site-alias syntax like so:

drush sql-sync @project.prod /var/www/project/docroot#default
petertornstrand commented 6 years ago

I'm having a similar issue as well. Using the alternative syntax described by @dman-coders did not help me though.

My project is setup using drupal-composer so the paths are /var/www (project root) and /var/www/web (drupal root).

Drush Launcher Version: 0.3.1 Drush Version : 8.1.13

Here is the output from drush sql-sync @website.prod /var/www/web#default --debug

Drush Launcher Version: 0.3.1
ROOT: /var/www
DRUPAL ROOT: /var/www/web
COMPOSER ROOT: /var/www
VENDOR ROOT: /var/www/vendor

Cache HIT cid: 8.1.13-commandfiles-0-5804666f8415c7e4d5891a16d2a193ff [0.05 sec, 3.87 MB]                                                                                                                                                                      [debug]
Loading drushrc "/var/www/drush/drushrc.php" into "drupal" scope. [0.28 sec, 6.64 MB]                                                                                                                                                                      [bootstrap]
Bootstrap to phase 0. [1.62 sec, 8.84 MB]                                                                                                                                                                                                                  [bootstrap]
Bootstrap to phase -1. [1.63 sec, 8.84 MB]                                                                                                                                                                                                                 [bootstrap]
Found command: sql-sync (commandfile=sqlsync) [1.63 sec, 8.84 MB]                                                                                                                                                                                          [bootstrap]
Calling drush command init function: drush_sql_sync_init [1.65 sec, 8.85 MB]                                                                                                                                                                               [bootstrap]
Drush bootstrap phase : bootstrap_drupal_root() [1.67 sec, 9.07 MB]                                                                                                                                                                                        [bootstrap]
Loading drushrc "/var/www/drush/drushrc.php" into "drupal" scope. [1.67 sec, 9.07 MB]                                                                                                                                                                      [bootstrap]
Initialized Drupal 8.3.6 root directory at /var/www/web [1.67 sec, 9.07 MB]                                                                                                                                                                                [bootstrap]
Find command files for phase 1 (max=2) [1.67 sec, 7.79 MB]                                                                                                                                                                                                     [debug]
Cache HIT cid: 8.1.13-commandfiles-1-7f611472e6aad31c2e098d90ca099208 [1.67 sec, 7.79 MB]                                                                                                                                                                      [debug]
Cache HIT cid: 8.1.13-annotationfiles-1-dbfac52f6b84f35e8b700a90d1e40b65 [1.68 sec, 7.89 MB]                                                                                                                                                                   [debug]
Drush bootstrap phase : bootstrap_drupal_site() [2.56 sec, 8.52 MB]                                                                                                                                                                                        [bootstrap]
Initialized Drupal site default at sites/default [2.56 sec, 8.52 MB]                                                                                                                                                                                       [bootstrap]
Find command files for phase 2 (max=2) [2.56 sec, 8.53 MB]                                                                                                                                                                                                     [debug]
Cache MISS cid: 8.1.13-install_profile-66ecfeb9791a023150773849f1550c5d [2.57 sec, 8.53 MB]                                                                                                                                                                    [debug]
Cache HIT cid: 8.1.13-commandfiles-2-922fe8da44dce18f081805a74eb1725e [2.57 sec, 8.53 MB]                                                                                                                                                                      [debug]
Loaded alias @website.prod from file /var/www/web/../drush/aliases.drushrc.php [3.77 sec, 10.7 MB]                                                                                                                                                        [notice]
Calling hook drush_sqlsync_sql_sync_validate [3.79 sec, 10.94 MB]                                                                                                                                                                                              [debug]
Backend invoke: ssh -o PasswordAuthentication=no user@www.website.se 'env COLUMNS=262 drush  --backend=2 --verbose --debug --local --uri=https://www.website.se --root=/mnt/persist/www/website/web  sql-conf   --all 2>&1' 2>&1 [3.79 sec,      [command]
10.95 MB]
ssh -o PasswordAuthentication=no user@www.website.se 'env COLUMNS=262 drush  --backend=2 --verbose --debug --local --uri=https://www.website.se --root=/mnt/persist/www/website/web  sql-conf   --all 2>&1' 2>&1 [3.8 sec, 10.95 MB]              [notice]
Backend invoke: env COLUMNS=262 /var/www/web/../vendor/bin//drush.launcher  --backend=2 --verbose --debug --local --uri=default --root=/var/www/web  sql-conf   --all 2>&1 [4.29 sec, 10.98 MB]                                                              [command]
env COLUMNS=262 /var/www/web/../vendor/bin//drush.launcher  --backend=2 --verbose --debug --local --uri=default --root=/var/www/web  sql-conf   --all 2>&1 [4.29 sec, 10.98 MB]                                                                               [notice]
You will destroy data in Website and replace with data from www.website.se/Website.
Do you really want to continue? (y/n): y
Returned from hook drush_sqlsync_sql_sync_validate [10.31 sec, 10.99 MB]                                                                                                                                                                                       [debug]
Calling hook drush_sqlsync_sql_sync [10.31 sec, 11.03 MB]                                                                                                                                                                                                      [debug]
Starting to dump database on Source. [10.31 sec, 11.03 MB]                                                                                                                                                                                                 [ok]
Backend invoke: ssh -o PasswordAuthentication=no user@www.website.se 'env COLUMNS=262 drush  --backend=2 --debug --strict=0 --verbose --local --root=/mnt/persist/www/website/web --uri=https://www.website.se  sql-dump   --gzip --result-file  [command]
2>&1' 2>&1 [10.31 sec, 11.04 MB]
ssh -o PasswordAuthentication=no user@www.website.se 'env COLUMNS=262 drush  --backend=2 --debug --strict=0 --verbose --local --root=/mnt/persist/www/website/web --uri=https://www.website.se  sql-dump   --gzip --result-file 2>&1' 2>&1        [notice]
[10.31 sec, 11.04 MB]
Using the Drush script found at /mnt/persist/www/Website/vendor/drush/drush/drush.launcher using pcntl_exec
Drush preflight prepare loaded autoloader at                         [preflight]
/mnt/persist/www/Website/vendor/autoload.php [0 sec, 2.85 MB]
Starting Drush preflight. [0 sec, 2.85 MB]                                                                                                                                                                                                                 [preflight]
Cache HIT cid: 8.1.10-commandfiles-0-5a286b00055b94bde153c5a214ac0e13 [0.01 sec, 3.08 MB]                                                                                                                                                                      [debug]
Loading drushrc "/mnt/persist/www/website/drush/drushrc.php" into "drupal" scope. [0.03 sec, 5.42 MB]                                                                                                                                                  [bootstrap]
Scanning into /mnt/persist/www/website/web/../drush for /.*aliases\.drush(8|)rc\.php$/ [0.06 sec, 7.49 MB]                                                                                                                                                 [debug]
Scanning into /mnt/persist/www/website/web/../drush for /self\.alias\.drush(8|)rc\.php$/ [0.06 sec, 7.49 MB]                                                                                                                                               [debug]
Scanning into /mnt/persist/www/website/web/drush for /.*aliases\.drush(8|)rc\.php$/ [0.06 sec, 7.49 MB]                                                                                                                                                    [debug]
Scanning into /mnt/persist/www/website/web/drush for /self\.alias\.drush(8|)rc\.php$/ [0.06 sec, 7.49 MB]                                                                                                                                                  [debug]
Scanning into /mnt/persist/www/website/web/sites/all/drush for /.*aliases\.drush(8|)rc\.php$/ [0.06 sec, 7.49 MB]                                                                                                                                          [debug]
Scanning into /mnt/persist/www/website/web/sites/all/drush for /self\.alias\.drush(8|)rc\.php$/ [0.06 sec, 7.49 MB]                                                                                                                                        [debug]
Scanning into /mnt/persist/www/website/web/sites/www.website.org for /.*aliases\.drush(8|)rc\.php$/ [0.06 sec, 7.49 MB]                                                                                                                                [debug]
Scanning into /mnt/persist/www/website/web/sites/www.website.org for /self\.alias\.drush(8|)rc\.php$/ [0.06 sec, 7.49 MB]                                                                                                                              [debug]
Bootstrap to phase 0. [10.76 sec, 7.5 MB]                                                                                                                                                                                                                  [bootstrap]
Bootstrap to phase -1. [10.76 sec, 7.5 MB]                                                                                                                                                                                                                 [bootstrap]
Found command: sql-dump (commandfile=sql) [10.76 sec, 7.5 MB]                                                                                                                                                                                              [bootstrap]
Calling hook drush_sql_dump [10.76 sec, 7.68 MB]                                                                                                                                                                                                               [debug]
Drush bootstrap phase : bootstrap_drupal_root() [10.76 sec, 7.87 MB]                                                                                                                                                                                       [bootstrap]
Loading drushrc "/mnt/persist/www/Website/drush/drushrc.php" into "drupal" scope. [10.76 sec, 7.87 MB]                                                                                                                                                 [bootstrap]
Initialized Drupal 8.3.6 root directory at /mnt/persist/www/website/web [10.76 sec, 7.87 MB]                                                                                                                                                           [bootstrap]
Find command files for phase 1 (max=3) [10.76 sec, 6.58 MB]                                                                                                                                                                                                    [debug]
Cache HIT cid: 8.1.10-commandfiles-1-63b00d6468446b3e65ac7f701ca3717e [10.76 sec, 6.58 MB]                                                                                                                                                                     [debug]
Cache HIT cid: 8.1.10-annotationfiles-1-98feaf16263d7f6b0b0f3d26684411b4 [10.76 sec, 6.66 MB]                                                                                                                                                                  [debug]
Drush bootstrap phase : bootstrap_drupal_site() [10.77 sec, 7.17 MB]                                                                                                                                                                                       [bootstrap]
Initialized Drupal site www.Website.org at sites/default [10.77 sec, 7.17 MB]                                                                                                                                                                          [bootstrap]
Find command files for phase 2 (max=3) [10.77 sec, 7.17 MB]                                                                                                                                                                                                    [debug]
Cache HIT cid: 8.1.10-install_profile-66ecfeb9791a023150773849f1550c5d [10.77 sec, 7.17 MB]                                                                                                                                                                    [debug]
Cache HIT cid: 8.1.10-commandfiles-2-bbdc55ee41d2d85d181b6a7385fc8c3c [10.77 sec, 7.18 MB]                                                                                                                                                                     [debug]
Drush bootstrap phase : bootstrap_drupal_configuration() [10.78 sec, 7.44 MB]                                                                                                                                                                              [bootstrap]
Create from request [10.78 sec, 7.45 MB]                                                                                                                                                                                                                       [debug]
add service modifier [10.78 sec, 7.58 MB]                                                                                                                                                                                                                      [debug]
Find command files for phase 3 (max=3) [10.78 sec, 7.58 MB]                                                                                                                                                                                                    [debug]
sql-query: SHOW TABLES; [10.78 sec, 7.71 MB]                                                                                                                                                                                                                  [notice]
Executing: mysql --defaults-extra-file=/tmp/drush_Sf9bRQ --database=Website --host=127.0.0.1 --port=3306 --silent  < /tmp/drush_LAUyJA
  batch
  block_content
  block_content__body
  ...
  webform_submission
  webform_submission_data
  webform_submission_log
Calling system(mysqldump --defaults-extra-file=/tmp/drush_xoP706  Website --host=127.0.0.1 --port=3306 --no-autocommit --single-transaction --opt -Q  | gzip -f > /root/drush-backups/Website/20170922085845/Website_20170922_085845.sql.gz);
Database dump saved to /root/drush-backups/Website/20170922085845/Website_20170922_085845.sql.gz [12.31 sec, 7.74 MB]                                                                                                                              [success]
Returned from hook drush_sql_dump [12.31 sec, 7.74 MB]                                                                                                                                                                                                         [debug]
Command dispatch complete [12.31 sec, 7.68 MB]                                                                                                                                                                                                                [notice]
Cache MISS cid: 8.1.10-alias-path--32fd48b4d08ea87fb58a405c1ff48423 [12.32 sec, 7.81 MB]                                                                                                                                                                       [debug]
Starting to discover temporary files directory on Destination. [12.33 sec, 11.08 MB]                                                                                                                                                                       [ok]
Backend invoke: env COLUMNS=262 /var/www/web/../vendor/bin//drush.launcher  --backend=2 --verbose --debug --local --uri=default --root=/var/www/web  core-status 2>&1 [12.34 sec, 11.09 MB]                                                                  [command]
env COLUMNS=262 /var/www/web/../vendor/bin//drush.launcher  --backend=2 --verbose --debug --local --uri=default --root=/var/www/web  core-status 2>&1 [12.34 sec, 11.09 MB]                                                                                   [notice]
Cache MISS cid: 8.1.13-alias-path--538d08dbcb2196caa779405d96dcd0c9 [16.37 sec, 11.12 MB]                                                                                                                                                                      [debug]
Backend invoke: env COLUMNS=262 /usr/local/bin/drush  --backend=2 --yes --verbose --debug --local --root=/var/www/web --uri=http://default  core-rsync                                                                                                       [command]
'@website.prod:/root/drush-backups/Website/20170922085845/Website_20170922_085845.sql.gz' '/var/www/web#default:/tmp/Website_20170922_085845.sql.gz'   --remove-source-files 2>&1 [17.21 sec, 11.13 MB]
env COLUMNS=262 /usr/local/bin/drush  --backend=2 --yes --verbose --debug --local --root=/var/www/web --uri=http://default  core-rsync '@website.prod:/root/drush-backups/Website/20170922085845/Website_20170922_085845.sql.gz'                  [notice]
'/var/www/web#default:/tmp/Website_20170922_085845.sql.gz'   --remove-source-files 2>&1 [17.21 sec, 11.13 MB]

Drush Launcher Version: 0.3.1
ROOT: /var/www/web
DRUPAL ROOT: /var/www/web
COMPOSER ROOT: /var/www/web
VENDOR ROOT: /var/www/web/vendor

The Drush launcher could not find a local Drush in your Drupal site.
Please add Drush with Composer to your project.
Run 'cd "/var/www/web" && composer require drush/drush'
The command could not be executed successfully (returned: Drush Launcher Version: 0.3.1                                                                                                                                                                    [error]
ROOT: /var/www/web
DRUPAL ROOT: /var/www/web
COMPOSER ROOT: /var/www/web
VENDOR ROOT: /var/www/web/vendor
The Drush launcher could not find a local Drush in your Drupal site.
Please add Drush with Composer to your project.
Run 'cd "/var/www/web" && composer require drush/drush'
, code: 1) [17.29 sec, 11.14 MB]
Copying dump file from Source to Destination. [17.29 sec, 11.09 MB]                                                                                                                                                                                        [ok]
Starting to import dump file onto Destination database. [17.29 sec, 11.09 MB]                                                                                                                                                                              [ok]
Backend invoke: env COLUMNS=262 /var/www/web/../vendor/bin//drush.launcher  --backend=2 --debug --strict=0 --verbose --local --uri=default --root=/var/www/web  sql-query   --file=/tmp/Website_20170922_085845.sql.gz --file-delete 2>&1 [17.29 sec,    [command]
11.1 MB]
env COLUMNS=262 /var/www/web/../vendor/bin//drush.launcher  --backend=2 --debug --strict=0 --verbose --local --uri=default --root=/var/www/web  sql-query   --file=/tmp/Website_20170922_085845.sql.gz --file-delete 2>&1 [17.29 sec, 11.1 MB]            [notice]
Drush preflight prepare loaded autoloader at                         [preflight]
/var/www/vendor/autoload.php [0.03 sec, 3.41 MB]
Starting Drush preflight. [0.03 sec, 3.41 MB]                                                                                                                                                                                                              [preflight]
Cache HIT cid: 8.1.13-commandfiles-0-5804666f8415c7e4d5891a16d2a193ff [0.05 sec, 3.76 MB]                                                                                                                                                                      [debug]
Loading drushrc "/var/www/drush/drushrc.php" into "drupal" scope. [0.28 sec, 6.55 MB]                                                                                                                                                                      [bootstrap]
Scanning into /var/www/web/../drush for /.*aliases\.drush(8|)rc\.php$/ [0.78 sec, 8.74 MB]                                                                                                                                                                     [debug]
Scanning into /var/www/web/../drush for /self\.alias\.drush(8|)rc\.php$/ [0.78 sec, 8.74 MB]                                                                                                                                                                   [debug]
Scanning into /var/www/web/drush for /.*aliases\.drush(8|)rc\.php$/ [0.79 sec, 8.74 MB]                                                                                                                                                                        [debug]
Scanning into /var/www/web/drush for /self\.alias\.drush(8|)rc\.php$/ [0.79 sec, 8.74 MB]                                                                                                                                                                      [debug]
Scanning into /var/www/web/sites/all/drush for /.*aliases\.drush(8|)rc\.php$/ [0.79 sec, 8.74 MB]                                                                                                                                                              [debug]
Scanning into /var/www/web/sites/all/drush for /self\.alias\.drush(8|)rc\.php$/ [0.79 sec, 8.75 MB]                                                                                                                                                            [debug]
Scanning into /var/www/web/sites/default for /.*aliases\.drush(8|)rc\.php$/ [0.79 sec, 8.75 MB]                                                                                                                                                                [debug]
Scanning into /var/www/web/sites/default for /self\.alias\.drush(8|)rc\.php$/ [1.2 sec, 8.75 MB]                                                                                                                                                               [debug]
Bootstrap to phase 0. [19.04 sec, 8.75 MB]                                                                                                                                                                                                                 [bootstrap]
Bootstrap to phase -1. [19.05 sec, 8.76 MB]                                                                                                                                                                                                                [bootstrap]
Found command: sql-query (commandfile=sql) [19.05 sec, 8.76 MB]                                                                                                                                                                                            [bootstrap]
Calling hook drush_sql_query [19.09 sec, 9.01 MB]                                                                                                                                                                                                              [debug]
Drush bootstrap phase : bootstrap_drupal_root() [19.11 sec, 9.17 MB]                                                                                                                                                                                       [bootstrap]
Loading drushrc "/var/www/drush/drushrc.php" into "drupal" scope. [19.11 sec, 9.17 MB]                                                                                                                                                                     [bootstrap]
Initialized Drupal 8.3.6 root directory at /var/www/web [19.11 sec, 9.18 MB]                                                                                                                                                                               [bootstrap]
Find command files for phase 1 (max=3) [19.11 sec, 7.89 MB]                                                                                                                                                                                                    [debug]
Cache HIT cid: 8.1.13-commandfiles-1-7f611472e6aad31c2e098d90ca099208 [19.11 sec, 7.89 MB]                                                                                                                                                                     [debug]
Cache HIT cid: 8.1.13-annotationfiles-1-dbfac52f6b84f35e8b700a90d1e40b65 [19.12 sec, 8 MB]                                                                                                                                                                     [debug]
Drush bootstrap phase : bootstrap_drupal_site() [19.15 sec, 8.62 MB]                                                                                                                                                                                       [bootstrap]
Initialized Drupal site default at sites/default [19.15 sec, 8.62 MB]                                                                                                                                                                                      [bootstrap]
Find command files for phase 2 (max=3) [19.15 sec, 8.62 MB]                                                                                                                                                                                                    [debug]
Cache MISS cid: 8.1.13-install_profile-66ecfeb9791a023150773849f1550c5d [19.15 sec, 8.62 MB]                                                                                                                                                                   [debug]
Cache HIT cid: 8.1.13-commandfiles-2-922fe8da44dce18f081805a74eb1725e [19.15 sec, 8.63 MB]                                                                                                                                                                     [debug]
Drush bootstrap phase : bootstrap_drupal_configuration() [19.2 sec, 9.08 MB]                                                                                                                                                                               [bootstrap]
Create from request [19.21 sec, 9.09 MB]                                                                                                                                                                                                                       [debug]
add service modifier [19.23 sec, 9.43 MB]                                                                                                                                                                                                                      [debug]
Find command files for phase 3 (max=3) [19.23 sec, 9.43 MB]                                                                                                                                                                                                    [debug]
finfo::file(/tmp/Website_20170922_085845.sql.gz): failed to open stream: No such file or directory drush.inc:892 [19.24 sec, 9.51 MB]                                                                                                                  [warning]
Examining /tmp/Website_20170922_085845.sql.gz headers. [19.24 sec, 9.51 MB]                                                                                                                                                                                [debug]
fopen(/tmp/Website_20170922_085845.sql.gz): failed to open stream: No such file or directory drush.inc:904 [19.25 sec, 9.51 MB]                                                                                                                        [warning]
Unable to open /tmp/Website_20170922_085845.sql.gz. [19.25 sec, 9.51 MB]                                                                                                                                                                               [warning]
Examining /tmp/Website_20170922_085845.sql.gz extension. [19.25 sec, 9.51 MB]                                                                                                                                                                              [debug]
Executing: mysql --defaults-extra-file=/tmp/drush_sNLI6o --database=Website --host=127.0.0.1 --port=3306 --silent  < /tmp/Website_20170922_085845.sql.gz
sh: 1: cannot open /tmp/Website_20170922_085845.sql.gz: No such file
Query failed. [19.25 sec, 11.13 MB]                                                                                                                                                                                                                        [error]
Returned from hook drush_sql_query [19.25 sec, 9.51 MB]                                                                                                                                                                                                        [debug]
Command dispatch complete [19.25 sec, 9.46 MB]                                                                                                                                                                                                                [notice]
Cache MISS cid: 8.1.13-alias-path--538d08dbcb2196caa779405d96dcd0c9 [19.26 sec, 9.62 MB]                                                                                                                                                                       [debug]
Returned from hook drush_sqlsync_sql_sync [20.1 sec, 11.11 MB]                                                                                                                                                                                                 [debug]
Command dispatch complete [20.1 sec, 11.03 MB] 
weitzman commented 6 years ago

looks like are using the drush launcher but not a site local drush? Make sure you use both of those programs on both sides of the sql-sync.

fubarhouse commented 6 years ago

In trying to identify how to use the current site as an argument for the indefinite future - as I'm wondering how I can future-proof what I'm doing, I came along this.

I'm not using Drush Launcher, nor have I yet, and I'm able to produce unexpected results...

image

The image may help diagnose this one.

greg-1-anderson commented 6 years ago

The @self alias is created once Drush figures out which site you'd like to bootstrap. In the case of drush @self status, that alias that tells Drush which site you'd like to bootstrap, so at the point in time when Drush reads it, @self does not exist yet.

This would be possible to fix by writing a temporary @self alias at the appropriate place in the bootstrap. If anyone wanted to take that on, it should be done in Drush 9 first. Note that the Drush 8 and Drush 9 bootstraps are substantially different. The Drush 9 bootstrap is easier to fiddle with. Changing the Drush 8 bootstrap is prone to side effects.

joelpittet commented 6 years ago

Looks to not exist in 9.3.0, maybe this was fixed?

greg-1-anderson commented 5 years ago

Yep, this works in Drush 9.