The following uses the watchdog-show command as an example but it applies to all commands.

With an aliases file, named test.aliases.drushrc.php, containing the following definitions

$aliases['group'] = array(
   'site-list' => array('@a', '@b',),
);

$aliases['a'] = array (
  'uri' => 'www.example.com.a',
  'root' => 'D:/web sites/drupal7',
  'command-specific' => array(
	'watchdog-show' => array('count' => '1',),
  ),
);

$aliases['b'] = array (
  'uri' => 'www.example.com.b',
  'root' => 'D:/web sites/drupal7',
  'command-specific' => array(
	'watchdog-show' => array('count' => '2',),
  ),
);

the following commands perform as expected, listing one and two log entries respectively.

drush @a watchdog-show
drush @b watchdog-show

However the following commands ignore the command-specific options in the alias file and list the default 10 log entries

drush @group watchdog-show
drush @test watchdog-show

The documentation in example.aliases.drushrc.php says

These options will only be set if the alias is used with the specified command

It would seem more helpful to me if these options were set when a group alias was used as well as when a site alias is used. If there is a reason why that is a bad idea then making clearer the limitations of group aliases would be good.

Comments

moshe weitzman’s picture

Component: Config » Base system (internal API)
Assigned: Unassigned » greg.1.anderson
Category: feature » bug

Sounds like a bug to me. Lets see what Greg thinks.

greg.1.anderson’s picture

This is a limitation - but I'm fine with calling it a bug and coming up with a solution. Shouldn't be too hard; I'll work on it.

greg.1.anderson’s picture

Status: Active » Needs review
StatusFileSize
new5.78 KB

Here is a patch that fixed this problem, and allows command-specific to work in alias lists. It is not quite as simple as it may seem, though; I had to remove a spurrious call to drush_set_config_special_contexts(), that should not be happening in drush_sitealias_get_record. I also added 'never-propagate' to the global 'php' and 'php-options' options, which, strictly speaking, is unrelated to this issue, but as long as I am here...

Running the test suite now.

greg.1.anderson’s picture

Tests are passing.

moshe weitzman’s picture

Version: 7.x-5.x-dev » 8.x-6.x-dev
Status: Needs review » Needs work

patch failed to apply

greg.1.anderson’s picture

Status: Needs work » Needs review
StatusFileSize
new5.81 KB

Rerolled.

moshe weitzman’s picture

Status: Needs review » Fixed

Committed. Thanks.

Status: Fixed » Closed (fixed)

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