I am attempting to sync a production database to a local environment. When I run something along the lines of:
drush sql-sync @mysite.prod @mysite.local --source-dump /path/to/dump --target-dump /path-to-dump --create-db --no-cache -y
I get the error:
Error: no database record could be found for target @mysite.local
However, drush @mysite.local sql-conf returns the correct connection information, and drush @mysite.local sql-cli connects to the correct database as expected.
Further, drush @mysite.local status and drush @mysite.prod status return the expected status reports.
Aliases file contents (for institutional reasons, making changes to this file is not ideal):
<?php
$aliases['local'] = array(
'parent' => '@parent',
'env' => 'local',
'site' => 'mysite',
'uri' => 'mysite.com',
'ssh-options' => '-o StrictHostKeyChecking=no ',
'sites-subdir' => 'mysite'
);
$aliases['prod'] = array(
'parent' => '@mysite.local',
'env' => 'prod',
'root' => '/var/www/html/mysite.prod/docroot',
'remote-host' => 'xxxxxx.myhost.com',
'remote-user' => 'mysite',
'path-aliases' => array(
'%drush-script' => '/usr/local/drush5/drush',
),
// #destinations is a custom property
'#destinations' => array(
'releases' => "[email protected]:mysite.git",
),
);
$aliases['stage'] = array(
'parent' => '@mysite.prod',
'env' => 'test',
'root' => '/var/www/html/mysite.test/docroot',
'remote-host' => 'xxxxxxxx.myhost.com',
);
$aliases['dev'] = array(
'parent' => '@mysite.stage',
'env' => 'dev',
'root' => '/var/www/html/mysite.dev/docroot',
);
?>
Debugger output
Bootstrap to phase 0. [0 sec, 3.79 MB] [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drush() [0.01 sec, 3.99 MB] [bootstrap]
Loading drushrc [bootstrap]
"/var/www/vhosts/docroot/sites/all/drush/drushrc.php" into
"drupal" scope. [0.01 sec, 4 MB]
Include /var/www/vhosts/docroot/sites/all/drush/commands [notice]
[0.01 sec, 4.02 MB]
Cache HIT cid: 6.2.0-commandfiles-0-xxxxxxxxxxxxxxxxxxxxx [debug]
[0.01 sec, 4.03 MB]
Bootstrap to phase 0. [0.06 sec, 9.36 MB] [bootstrap]
Bootstrap to phase 0. [0.08 sec, 9.36 MB] [bootstrap]
Found command: sql-sync (commandfile=sql) [0.08 sec, 9.36 MB] [bootstrap]
Including /usr/share/pear/drush/commands/sql/sync.sql.inc [0.14 sec, [bootstrap]
9.38 MB]
Calling drush command init function: drush_sql_sync_init [0.14 sec, [bootstrap]
9.58 MB]
Loaded alias @mysite.local from file [notice]
/var/www/vhosts/docroot/sites/all/drush/aliases/mysite.aliases.drushrc.php
[0.25 sec, 9.6 MB]
Undefined index: root sitealias.inc:1168 [0.25 sec, 9.6 MB] [notice]
Undefined index: root sitealias.inc:1168 [0.43 sec, 9.62 MB] [notice]
Loaded alias @mysite.prod from file [notice]
/var/www/vhosts/docroot/sites/all/drush/aliases/mysite.aliases.drushrc.php
[0.49 sec, 9.62 MB]
Loaded alias @mysite.stage from file [notice]
/var/www/vhosts/docroot/sites/all/drush/aliases/mysite.aliases.drushrc.php
[0.56 sec, 9.62 MB]
Loaded alias @mysite.dev from file [notice]
/var/www/vhosts/docroot/sites/all/drush/aliases/mysite.aliases.drushrc.php
[0.63 sec, 9.66 MB]
Undefined index: root sitealias.inc:1168 [0.63 sec, 9.66 MB] [notice]
Backend invoke: ssh -o StrictHostKeyChecking=no [command]
[email protected] '/usr/local/drush6/drush
--backend=2 --verbose --debug --yes --uri=mysite.com
--root=/var/www/html/mysite.dev/docroot sql-conf --all 2>&1' 2>&1
[0.74 sec, 9.68 MB]
ssh -o StrictHostKeyChecking=no [notice]
[email protected] '/usr/local/drush6/drush
--backend=2 --verbose --debug --yes --uri=mysite.com
--root=/var/www/html/mysite.dev/docroot sql-conf --all 2>&1' 2>&1
[0.74 sec, 9.68 MB]
Calling hook drush_sql_sync [3.34 sec, 9.72 MB] [debug]
Undefined index: root sitealias.inc:1168 [3.34 sec, 9.73 MB] [notice]
Error: no database record could be found for target @mysite.local [error]
[3.34 sec, 9.73 MB]
Returned from hook drush_sql_sync [3.34 sec, 9.73 MB] [debug]
Command dispatch complete [3.34 sec, 9.7 MB] [notice]
Peak memory usage was 11.99 MB [3.34 sec, 9.7 MB] [memory]
Any help debugging this would be greatly appreciated.