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.34k stars 1.08k forks source link

drush @sites command doesn't work #2519

Open ghost opened 7 years ago

ghost commented 7 years ago

I asked the next question in: http://drupal.stackexchange.com/q/223608/30565

The command drush @sites status doesn't do anything.

The full command obtained for the process is:

/usr/bin/php /home/myuser/.config/composer/vendor/drush/drush/drush.php --php=/usr/bin/php --php-options= @sites status

This is my enviroment:

The "drush site-alias" command says me:

I have a setup for Drupal multi-sites with subdirectories, the aliases file is:

~/.drush/aliases.drushrc.php

<?php
/**
 * @file
 * Site alias for all sites
 */
$root = '/var/www/html';

$aliases['site1'] = array(
    'uri' => 'multisite.local/site1',
    'root' => $root,
    'path-aliases' => array(
        '%dump-dir' => '/tmp'
    ),
);
$aliases['site2'] = array(
    'uri' => 'multisite.local/site2',
    'root' => $root,
    'path-aliases' => array(
        '%dump-dir' => '/tmp'
    ),
);

The full output of the "drush status" command is:

 Drupal version                  :  8.2.4
 Site URI                        :  http://default
 Database driver                 :  mysql
 Database hostname               :  localhost
 Database port                   :  3306
 Database username               :  db_user
 Database name                   :  db_name
 Database                        :  Connected
 Drupal bootstrap                :  Successful
 Drupal user                     :
 Default theme                   :  bootstrap
 Administration theme            :  seven
 PHP executable                  :  /usr/bin/php
 PHP configuration               :  /etc/php.ini
 PHP OS                          :  Linux
 Drush script                    :  /home/myuser/.config/composer/vendor/drush/drush/drush.php
 Drush version                   :  8.1.7
 Drush temp directory            :  /tmp
 Drush configuration             :
 Drush alias files               :  /home/myuser/.drush/aliases.drushrc.php
 Install profile                 :  standard
 Drupal root                     :  /var/www/html
 Drupal Settings File            :  sites/default/settings.php
 Site path                       :  sites/default
 File directory path             :  sites/default/files
 Private file directory path     :  private/default
 Temporary file directory path   :  /tmp
 Sync config path                :  sites/default/files/config_BrLQsjBr6VkcTEyCkzkY-es-hzISWg4d3oV2EEEoqh-UZMLBJWDiDaq78TIWm-lBbVi-aPHISw/sync
kwfinken commented 7 years ago

We have a similar and perhaps related issue:

All of this worked fine in drush 5.10. It is only since we jumped from the 5 branch directly to drush 8.1.10 that we have had the issue.

The ultimate questions are: Is this a bug in drush 8 or a configuration issue? If it is configuration, what do we need to change?

When we execute drush @sites cc all -y (or any other drush command), the result is:

.var.www.intranet#digitalcuration-intranet.test.lib.msu.edu >> No    [warning]
Drupal site found, only 'drush' cache was cleared.
.var.www.intranet#default                                   >> 'all' [success]
cache was cleared.
.var.www.intranet#dsc-intranet.test.lib.msu.edu             >> No    [warning]
Drupal site found, only 'drush' cache was cleared.
.var.www.intranet#dmc-intranet.test.lib.msu.edu             >> No    [warning]
Drupal site found, only 'drush' cache was cleared.
.var.www.intranet#ref-intranet.test.lib.msu.edu             >> No    [warning]
Drupal site found, only 'drush' cache was cleared.
.var.www.intranet#lec-intranet.test.lib.msu.edu             >> No    [warning]
Drupal site found, only 'drush' cache was cleared.
.var.www.intranet#techserv-intranet.test.lib.msu.edu        >> No    [warning]
Drupal site found, only 'drush' cache was cleared.
.var.www.intranet#printoffice-intranet.test.lib.msu.edu     >> No    [warning]
Drupal site found, only 'drush' cache was cleared.
.var.www.intranet#copyctr-intranet.test.lib.msu.edu         >> No    [warning]
Drupal site found, only 'drush' cache was cleared.

In addition, if we execute drush dmc-intranet.test.lib.msu.edu cc all, the result is (same error for any sub-site/drush command):

The drush command 'dmc-intranet.test.lib.msu.edu cc all' [error]
could not be found.  Run `drush cache-clear drush` to clear the
commandfile cache if you have installed new extensions.

The output of drush site-alias seems fine:

@none
@self
copyctr-intranet.test.lib.msu.edu
default
digitalcuration-intranet.test.lib.msu.edu
dmc-intranet.test.lib.msu.edu
dsc-intranet.test.lib.msu.edu
lec-intranet.test.lib.msu.edu
printoffice-intranet.test.lib.msu.edu
ref-intranet.test.lib.msu.edu
techserv-intranet.test.lib.msu.edu

drush status on the default yields:

 Drupal version                  :  7.54
 Site URI                        :  http://default
 Database driver                 :  <correct info>
 Database hostname               :  <correct info>
 Database port                   :  <correct info>
 Database username               :  <correct info>
 Database name                   :  <correct info>
 Database                        :  Connected
 Drupal bootstrap                :  Successful
 Drupal user                     :
 Default theme                   :  skeletontheme
 Administration theme            :  seven
 PHP executable                  :  <correct info>
 PHP configuration               :  <correct info>
 PHP OS                          :  Linux
 Drush script                    :  /usr/local/bin/drush-8/vendor/drush/drush/drush.php
 Drush version                   :  8.1.10
 Drush temp directory            :  /tmp
 Drush configuration             :
 Drush alias files               :
 Install profile                 :  standard
 Drupal root                     :  <correct info>
 Drupal Settings File            :  <correct info>
 Site path                       :  <correct info>
 File directory path             :  <correct info>
 Private file directory path     :  <correct info>
 Temporary file directory path   :  /tmp

drush status while in a sub-site's directory yields:

 Drupal version         :  7.54
 Site URI               :  http://dmc-intranet.test.lib.msu.edu
 Database driver        :  <correct info>
 Database hostname      :  <correct info>
 Database port          :  <correct info>
 Database username      :  <correct info>
 Database name          :  <correct info>
 PHP executable         :  <correct info>
 PHP configuration      :  <correct info>
 PHP OS                 :  Linux
 Drush script           :  /usr/local/bin/drush-8/vendor/drush/drush/drush.php
 Drush version          :  8.1.10
 Drush temp directory   :  /tmp
 Drush configuration    :
 Drush alias files      :
 Drupal root            :  <correct info>
 Drupal Settings File   :  <correct info>
 Site path              :  <correct info>

For any given subsite, drush sql-cli works while I am in that sub-site's directory, but if I am in Drupal root, drush dmc-intranet.test.lib.msu.edu sql-cli (or any other subsite) yields:

The drush command 'dmc-intranet.test.lib.msu.edu sql-cli' could not be found.
Run `drush cache-clear drush` to clear the commandfile cache if you have
installed new extensions.                          [error]

In a site's directory, drush cc all -vvv yields:

Executing: mysql --defaults-extra-file=/tmp/drush_qtoPT4 --database=<correct info> --host=<correct info> --port=<correct info> --silent  < /tmp/drush_PFt1pG
Executing: mysql --defaults-extra-file=/tmp/drush_gpJhUR --database=<correct info> --host=<correct info> --port=<correct info> --silent  < /tmp/drush_PgZ2ot
No Drupal site found, only 'drush' cache was cleared.                                                                                                                                                      [warning]
Command dispatch complete                                                                                                                                                                                     [notice]

In a site directory, drush cc all -d -v gives

Using the Drush script found at /usr/local/bin/drush-8/vendor/drush/drush/drush.launcher using pcntl_exec
Drush preflight prepare loaded autoloader at                         [preflight]
/usr/local/bin/drush-8/vendor/autoload.php [0.01 sec, 3.14 MB]
Starting Drush preflight. [0.01 sec, 3.14 MB]                                                                                                                                                              [preflight]
Cache MISS cid: 8.1.10-commandfiles-0-530713fe611e8043e400461577483e72 [0.02 sec, 3.56 MB]                                                                                                                     [debug]
Cache SET cid: 8.1.10-commandfiles-0-530713fe611e8043e400461577483e72 [0.02 sec, 3.58 MB]                                                                                                                      [debug]
Scanning into /etc/drush for /.*aliases\.drush(8|)rc\.php$/ [0.05 sec, 6.77 MB]                                                                                                                                [debug]
Scanning into /etc/drush for /self\.alias\.drush(8|)rc\.php$/ [0.05 sec, 6.77 MB]                                                                                                                              [debug]
Scanning into /usr/local/bin/drush-8/vendor/drush/drush/includes/.. for /.*aliases\.drush(8|)rc\.php$/ [0.05 sec, 6.77 MB]                                                                                     [debug]
Scanning into /usr/local/bin/drush-8/vendor/drush/drush/includes/.. for /self\.alias\.drush(8|)rc\.php$/ [0.06 sec, 6.78 MB]                                                                                   [debug]
Scanning into /home/finkenb2/.drush for /.*aliases\.drush(8|)rc\.php$/ [0.06 sec, 6.78 MB]                                                                                                                     [debug]
Scanning into /home/finkenb2/.drush for /self\.alias\.drush(8|)rc\.php$/ [0.06 sec, 6.78 MB]                                                                                                                   [debug]
Scanning into /var/www/intranet/../drush for /.*aliases\.drush(8|)rc\.php$/ [0.06 sec, 6.78 MB]                                                                                                                [debug]
Scanning into /var/www/intranet/../drush for /self\.alias\.drush(8|)rc\.php$/ [0.06 sec, 6.78 MB]                                                                                                              [debug]
Scanning into /var/www/intranet/drush for /.*aliases\.drush(8|)rc\.php$/ [0.06 sec, 6.78 MB]                                                                                                                   [debug]
Scanning into /var/www/intranet/drush for /self\.alias\.drush(8|)rc\.php$/ [0.07 sec, 6.78 MB]                                                                                                                 [debug]
Scanning into /var/www/intranet/sites/all/drush for /.*aliases\.drush(8|)rc\.php$/ [0.07 sec, 6.78 MB]                                                                                                         [debug]
Scanning into /var/www/intranet/sites/all/drush for /self\.alias\.drush(8|)rc\.php$/ [0.07 sec, 6.78 MB]                                                                                                       [debug]
Scanning into /var/www/intranet/sites/default for /.*aliases\.drush(8|)rc\.php$/ [0.07 sec, 6.79 MB]                                                                                                           [debug]
Scanning into /var/www/intranet/sites/default for /self\.alias\.drush(8|)rc\.php$/ [0.07 sec, 6.79 MB]                                                                                                         [debug]
Bootstrap to phase 0. [0.25 sec, 10.53 MB]                                                                                                                                                                 [bootstrap]
Trying to bootstrap as far as we can. [0.25 sec, 10.53 MB]                                                                                                                                                     [debug]
Drush bootstrap phase : bootstrap_drupal_root() [0.26 sec, 11 MB]                                                                                                                                          [bootstrap]
Initialized Drupal 7.54 root directory at /var/www/intranet [0.27 sec, 11 MB]                                                                                                                              [bootstrap]
Find command files for phase 1 (max=7) [0.27 sec, 8.59 MB]                                                                                                                                                     [debug]
Cache MISS cid: 8.1.10-commandfiles-1-9154f0f9c81a2343094756311c195680 [0.27 sec, 8.59 MB]                                                                                                                     [debug]
Cache SET cid: 8.1.10-commandfiles-1-9154f0f9c81a2343094756311c195680 [0.27 sec, 8.59 MB]                                                                                                                      [debug]
Cache MISS cid: 8.1.10-annotationfiles-1-bea952999b924118a6c6a37119d39b67 [0.27 sec, 8.59 MB]                                                                                                                  [debug]
Cache SET cid: 8.1.10-annotationfiles-1-bea952999b924118a6c6a37119d39b67 [0.27 sec, 8.6 MB]                                                                                                                    [debug]
Scanning into /etc/drush for /.*aliases\.drush(8|)rc\.php$/ [0.27 sec, 8.6 MB]                                                                                                                                 [debug]
Scanning into /etc/drush for /self\.alias\.drush(8|)rc\.php$/ [0.27 sec, 8.6 MB]                                                                                                                               [debug]
Scanning into /usr/local/bin/drush-8/vendor/drush/drush/includes/.. for /.*aliases\.drush(8|)rc\.php$/ [0.27 sec, 8.6 MB]                                                                                      [debug]
Scanning into /usr/local/bin/drush-8/vendor/drush/drush/includes/.. for /self\.alias\.drush(8|)rc\.php$/ [0.28 sec, 8.6 MB]                                                                                    [debug]
Scanning into /home/finkenb2/.drush for /.*aliases\.drush(8|)rc\.php$/ [0.28 sec, 8.61 MB]                                                                                                                     [debug]
Scanning into /home/finkenb2/.drush for /self\.alias\.drush(8|)rc\.php$/ [0.28 sec, 8.61 MB]                                                                                                                   [debug]
Scanning into /var/www/intranet/../drush for /.*aliases\.drush(8|)rc\.php$/ [0.28 sec, 8.61 MB]                                                                                                                [debug]
Scanning into /var/www/intranet/../drush for /self\.alias\.drush(8|)rc\.php$/ [0.28 sec, 8.61 MB]                                                                                                              [debug]
Scanning into /var/www/intranet/drush for /.*aliases\.drush(8|)rc\.php$/ [0.28 sec, 8.61 MB]                                                                                                                   [debug]
Scanning into /var/www/intranet/drush for /self\.alias\.drush(8|)rc\.php$/ [0.28 sec, 8.61 MB]                                                                                                                 [debug]
Scanning into /var/www/intranet/sites/all/drush for /.*aliases\.drush(8|)rc\.php$/ [0.28 sec, 8.61 MB]                                                                                                         [debug]
Scanning into /var/www/intranet/sites/all/drush for /self\.alias\.drush(8|)rc\.php$/ [0.28 sec, 8.61 MB]                                                                                                       [debug]
Scanning into /var/www/intranet/sites/dmc-intranet.test.lib.msu.edu for /.*aliases\.drush(8|)rc\.php$/ [0.28 sec, 8.62 MB]                                                                                     [debug]
Scanning into /var/www/intranet/sites/dmc-intranet.test.lib.msu.edu for /self\.alias\.drush(8|)rc\.php$/ [0.29 sec, 8.62 MB]                                                                                   [debug]
Drush bootstrap phase : bootstrap_drupal_site() [0.29 sec, 8.62 MB]                                                                                                                                        [bootstrap]
Initialized Drupal site dmc-intranet.test.lib.msu.edu at sites/dmc-intranet.test.lib.msu.edu [0.29 sec, 8.62 MB]                                                                                           [bootstrap]
Find command files for phase 2 (max=7) [0.3 sec, 8.62 MB]                                                                                                                                                      [debug]
Drush bootstrap phase : bootstrap_drupal_configuration() [0.3 sec, 8.62 MB]                                                                                                                                [bootstrap]
Find command files for phase 3 (max=7) [0.3 sec, 8.64 MB]                                                                                                                                                      [debug]
sql-query: SELECT 1; [0.3 sec, 8.78 MB]                                                                                                                                                                       [notice]
Executing: mysql --defaults-extra-file=/tmp/drush_0YF4k5 --database=intranet_dmc --host=mariad.lib.msu.edu --port=3306 --silent  < /tmp/drush_ypxt65
  1
sql-query: SHOW TABLES; [0.31 sec, 8.78 MB]                                                                                                                                                                   [notice]
Executing: mysql --defaults-extra-file=/tmp/drush_CGi5Q3 --database=intranet_dmc --host=mariad.lib.msu.edu --port=3306 --silent  < /tmp/drush_sKh4A4
  actions
  authmap
  backup_migrate_destinations
  backup_migrate_profiles
  backup_migrate_schedules
  batch
  block
  block_custom
  block_node_type
  block_role
  blocked_ips
  cache
  cache_admin_menu
  cache_block
  cache_bootstrap
  cache_field
  cache_filter
  cache_form
  cache_image
  cache_libraries
  cache_menu
  cache_page
  cache_path
  cache_rules
  cache_token
  cache_update
  cache_views
  cache_views_data
  ckeditor_input_format
  ckeditor_settings
  comment
  content_access
  ctools_css_cache
  ctools_object_cache
  date_format_locale
  date_format_type
  date_formats
  field_config
  field_config_instance
  field_data_body
  field_data_comment_body
  field_data_field_given_name
  field_data_field_image
  field_data_field_surname
  field_data_field_tags
  field_data_ldap_user_current_dn
  field_data_ldap_user_last_checked
  field_data_ldap_user_ldap_exclude
  field_data_ldap_user_prov_entries
  field_data_ldap_user_puid
  field_data_ldap_user_puid_property
  field_data_ldap_user_puid_sid
  field_revision_body
  field_revision_comment_body
  field_revision_field_given_name
  field_revision_field_image
  field_revision_field_surname
  field_revision_field_tags
  field_revision_ldap_user_current_dn
  field_revision_ldap_user_last_checked
  field_revision_ldap_user_ldap_exclude
  field_revision_ldap_user_prov_entries
  field_revision_ldap_user_puid
  field_revision_ldap_user_puid_property
  field_revision_ldap_user_puid_sid
  file_managed
  file_usage
  filter
  filter_format
  flood
  history
  image_effects
  image_styles
  ldap_authorization
  ldap_query
  ldap_servers
  masquerade
  masquerade_users
  menu_custom
  menu_links
  menu_router
  node
  node_access
  node_comment_statistics
  node_revision
  node_type
  pathauto_state
  poll
  poll_choice
  poll_vote
  queue
  rdf_mapping
  registry
  registry_file
  role
  role_permission
  rules_config
  rules_dependencies
  rules_tags
  rules_trigger
  scanner
  search_dataset
  search_index
  search_node_links
  search_total
  semaphore
  sequences
  sessions
  shortcut_set
  shortcut_set_users
  system
  taxonomy_index
  taxonomy_term_data
  taxonomy_term_hierarchy
  taxonomy_vocabulary
  tracker_node
  tracker_user
  trigger_assignments
  url_alias
  users
  users_roles
  variable
  views_display
  views_view
  watchdog
  webform
  webform_component
  webform_conditional
  webform_conditional_actions
  webform_conditional_rules
  webform_emails
  webform_last_download
  webform_roles
  webform_submissions
  webform_submitted_data
Bootstrap phase bootstrap_drupal_database() failed to validate; continuing at bootstrap_drupal_configuration(). [0.33 sec, 8.8 MB]                                                                             [debug]
Found command: cache-clear (commandfile=cache) [0.33 sec, 8.8 MB]                                                                                                                                          [bootstrap]
Calling hook drush_cache_clear_pre_validate [0.45 sec, 11.5 MB]                                                                                                                                                [debug]
Returned from hook drush_cache_clear_pre_validate [0.46 sec, 11.57 MB]                                                                                                                                         [debug]
Calling hook drush_cache_command_clear [0.46 sec, 11.59 MB]                                                                                                                                                    [debug]
Calling drush_cache_clear_both() [0.46 sec, 11.6 MB]                                                                                                                                                           [debug]
No Drupal site found, only 'drush' cache was cleared. [0.46 sec, 11.6 MB]                                                                                                                                  [warning]
Returned from hook drush_cache_command_clear [0.46 sec, 11.6 MB]                                                                                                                                               [debug]
Command dispatch complete [0.46 sec, 11.56 MB]                                                                                                                                                                [notice]
 Timer  Cum (sec)  Count  Avg (msec)
 page   0.166      1      166.07