I'm trying to sync a prod db to two dev drupal installations at once, instead of having prod db dumped/rsynced twice. In aliases.drush.inc I'm defining a site-list alias as following:

$aliases['dev'] = array(
  'site-list' => array('@dev1', '@dev2'),
);

$aliases['prod'] = array(
  'uri' => 'default/prod',
  'root' => '/docroot/prod',
  'db-url' => 'mysqli://root:pass@localhost/prod',
);  
$aliases['dev1'] = array(
  'uri' => 'default/dev1',
  'root' => '/docroot/dev1',
  'db-url' => 'mysqli://root:pass@localhost/dev1',
);
$aliases['dev2'] = array(
  'uri' => 'default/dev2',
  'root' => '/docroot/dev2',
  'db-url' => 'mysqli://root:pass@localhost/dev2',
);

Running a drush command against any of these aliases works fine. Running "drush @dev status" works fine too and displays status for both @dev1 and @dev2.

However, trying to execute "drush sql-sync @prod @dev" gives me the following error:

Error: no alias record could be found for @dev 

Any clues?

Thanks

Comments

moshe weitzman’s picture

Assigned: Unassigned » greg.1.anderson
Category: support » bug
Priority: Normal » Minor

This feature is buggy in drush and will be removed. I suggest that you call sql-sync twice. The second time will reuse the dump from the first time so that you don't really waste any cycles anyway.

Leaving open to remove this feature from sql-sync

greg.1.anderson’s picture

I double-checked this, and the sql-sync feature will copy from multiple sources to multiple destinations (e.g. sync all live sites to all dev sites). I'm ambivalent about removing this; might be useful if we ever get alias sets. The big weakness of this code is insuring that the two lists are in alignment, so that you don't sync to the wrong site. (!)

Remon’s picture

@greg.1.anderson

sql-sync feature will copy from multiple sources to multiple destinations

That is the trick, I'm using a single source and thats why it fails IMO. If I pass $allow_single_source = TRUE to drush_do_multiple_command() in sync.sql.inc, it syncs correctly.
Thanks for your reply.

greg.1.anderson’s picture

Yeah, I started to support that (one source, multiple destinations), but never got the code all the way up to the point where it was supported from the command handler. I'm surprised that it works as well as it does. I think that feature, and the one I mention in #2 are going to be pulled out. Instead, we'll first support a single-option sync, drush @localdevsite sql-sync that will look for a well-known alias @localdevsite.peer, or something like that, and pull from that site. That handles ambiguities in the multi-multi sync case. That doesn't help for the single-multi case; I don't think I'm likely to want to support that.

greg.1.anderson’s picture

Version: » 8.x-6.x-dev
Status: Active » Closed (won't fix)
Issue tags: +Needs migration

Test iq-submit to close and tag an issue

greg.1.anderson’s picture

Issue tags: +test tag

Test iq-submit to append a tag