Hi,

I defined an alias for a site in /etc/drush/xxxxxxx.alias.drushrc.php like this

$aliases['dev'] = array(
    'uri' => 'dev.xxxxxxxx.org',
    'root' => '/home/vhosts/xxxxxx/dev',
);

It seems to work

>drush sa
@dev

But when I try to get the status or other instructions it fails

>drush @dev status
The drush command '@dev status' could not be found.

Anyone can help me configuring aliases, please?

Thank you.

Comments

Thithi32’s picture

Issue summary: View changes

Just modifying for privacy purpose

Thithi32’s picture

Component: Core Commands » User Commands
greg.1.anderson’s picture

Component: User Commands » Base system (internal API)
Status: Active » Postponed (maintainer needs more info)

Run with --debug, perhaps? Everything in #0 looks okay.

Thithi32’s picture

When I run the command "drush @dev status --debug" in the site root folder it gives me:

Bootstrap to phase 0. [0.01 sec, 2.79 MB]                            [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drush() [0.01 sec, 3.01 MB] [bootstrap]
Load alias @dev [0.01 sec, 3.02 MB]                                                       [notice]
Bootstrap to phase 5. [0.03 sec, 6.69 MB]                                               [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_root() [0.03 sec, 6.7 MB]  [bootstrap]
Initialized Drupal 7.12 root directory at /home/vhosts/bioscene/dev [0.04 sec, 8.29 MB]   [notice]
Drush bootstrap phase : _drush_bootstrap_drupal_site() [0.04 sec, 8.3 MB]  [bootstrap]
Initialized Drupal site default at sites/default [0.04 sec, 8.3 MB]                  [notice]
Load alias @dev [0.04 sec, 8.3 MB]                                                        [notice]
Drush bootstrap phase : _drush_bootstrap_drupal_configuration() [0.04 sec, 8.31 MB] [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_database() [0.04 sec, 8.32 MB] [bootstrap]
Successfully connected to the Drupal database. [0.04 sec, 8.32 MB]              [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_full() [0.05 sec, 9.13 MB]    [bootstrap]
The drush command '@dev status' could not be found. [0.29 sec, 41.75 Mo]   [error]

Outside the root folder the answer is

Bootstrap to phase 0. [0.01 sec, 2.79 MB]                            [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drush() [0.01 sec, 3.01 MB] [bootstrap]
Load alias @dev [0.01 sec, 3.02 MB]                                               [notice]
Bootstrap to phase 5. [0.03 sec, 6.69 MB]                                       [bootstrap]
The drush command '@dev status' could not be found. [0.03 sec, 6.7 MB] [error]
A Drupal installation directory could not be found [0.03 sec, 6.7 MB]     [error]

The answer seems somewhere else ....

Thithi32’s picture

When I execute " drush --root=/home/vhosts/xxxxxxxx/dev --uri=dev.xxxxxx.org status" it gives me the correct answer ....

greg.1.anderson’s picture

Your symptoms are similar to #1551574: Alias loaded but not used (Windows 7) -- SOLVED (syntax), but we can't blame Windows paths or the path-alias setting here.

What does drush sa @dev produce? How about drush sa @xxxxxx (where xxxxx comes from the redacted portion of /etc/drush/xxxxxxx.alias.drushrc.php)?

greg.1.anderson’s picture

Status: Postponed (maintainer needs more info) » Fixed

The debug message "Load @dev" actually means "Searching for @dev". This is deceptive, and should be changed.

Reviewing your original report, I see that your problem is that your alias file cannot be found, because it is misnamed. You stored your alias in the file /etc/drush/xxxxxxx.alias.drushrc.php, which will ONLY work if xxxxxxx is "dev". This is because the filename pattern ".alias.drushrc.php" is for storing a single named alias. If your alias file stores multiple aliases, use /etc/drush/xxxxxxx.aliases.drushrc.php instead.

Thithi32’s picture

Right on target! Thank you very much Greg. I knew it was something like that, but I couldn't find it.
Thumbs up!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

ifernando’s picture

It works for me after noticing that the file name should be aliases.drushrc.php.

ifernando’s picture

Issue summary: View changes

Just modifying for privacy purpose