Closed (fixed)
Project:
Drush
Version:
8.x-6.x-dev
Component:
Base system (internal API)
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
15 Jul 2013 at 23:28 UTC
Updated:
30 Jul 2013 at 14:41 UTC
I've been using drush_invoke_process() extensively in Drush Rebuild. All worked well with 8.x-6.0-beta1. With 8.x-6.0-rc1 (and the latest dev), the db-url parameter from the site alias passed to drush_invoke_process() is added as a command-line option, causing drush_invoke_process() to fail.
I'm not sure if I am supposed to call drush_invoke_process() differently or if this is a bug. I did find that if I pass 'method' => 'POST' as a backend option, the call succeeds.
For example, with 'method' => 'GET' (default):
drush_invoke_process($this->environment, 'site-alias', array($source), array('short' => TRUE), array('integrate' => FALSE));
Backend invoke: /usr/local/bin/php -d memory_limit="512M" -d error_reporting="E_ALL|E_NOTICE|E_STRICT" -d [command]
display_errors="stderr" /Users/kosta/src/drupal/drush/drush.php --php=/usr/local/bin/php --php-options='-d
memory_limit="512M" -d error_reporting="E_ALL|E_NOTICE|E_STRICT" -d display_errors="stderr" ' --backend=2
--verbose --debug --root=/Users/kosta/src/site/docroot --uri=http://local.example.com
site-alias '@example.prod' --short --db-url='mysql://root@127.0.0.1/example_local' 2>&1 [2.66 sec, 21.51 MB]
/usr/local/bin/php -d memory_limit="512M" -d error_reporting="E_ALL|E_NOTICE|E_STRICT" -d [notice]
display_errors="stderr" /Users/kosta/src/drupal/drush/drush.php --php=/usr/local/bin/php --php-options='-d
memory_limit="512M" -d error_reporting="E_ALL|E_NOTICE|E_STRICT" -d display_errors="stderr" ' --backend=2
--verbose --debug --root=/Users/kosta/src/example/docroot --uri=http://local.ipihd.org
site-alias '@example.prod' --short --db-url='mysql://root@127.0.0.1/example_local' 2>&1 [2.66 sec, 21.52 MB]
With 'method' => 'POST':
drush_invoke_process($this->environment, 'site-alias', array($source), array('short' => TRUE), array('integrate' => FALSE, 'method' => 'POST'));
Backend invoke: /usr/local/bin/php -d memory_limit="512M" -d error_reporting="E_ALL|E_NOTICE|E_STRICT" -d [command]
display_errors="stderr" /Users/kosta/src/drupal/drush/drush.php --php=/usr/local/bin/php --php-options='-d
memory_limit="512M" -d error_reporting="E_ALL|E_NOTICE|E_STRICT" -d display_errors="stderr" ' --backend=2
--root=/Users/kosta/src/example/docroot --uri=http://local.example.com site-alias
'@example.prod' 2>&1 [2.52 sec, 21.51 MB]
/usr/local/bin/php -d memory_limit="512M" -d error_reporting="E_ALL|E_NOTICE|E_STRICT" -d [notice]
display_errors="stderr" /Users/kosta/src/drupal/drush/drush.php --php=/usr/local/bin/php --php-options='-d
memory_limit="512M" -d error_reporting="E_ALL|E_NOTICE|E_STRICT" -d display_errors="stderr" ' --backend=2
--root=/Users/kosta/src/example/docroot --uri=http://local.example.com site-alias
'@example.prod' 2>&1 [2.52 sec, 21.52 MB]
Comments
Comment #1
kostajh commentedThe
dispatch-using-aliasbackend option also results in success when calling drush_invoke_process().Comment #2
greg.1.anderson commentedThis is directly related to https://drupal.org/node/2017189#comment-7648547, although it is a separate issue (or natural consequence?).
'db-url' was always added, but now it is an error to do so. Some workarounds are listed in #2017189: Option validation skipped for --backend requests; however, since db-url is presumably a common option in site aliases, perhaps we should add 'db-url' as a global Drush option, so that it does not cause an error when included in an alias definition?
Comment #3
kostajh commentedThat seems like a good idea to me. I ended up using the
dispatch-using-aliasoption to get things working again.Comment #4
greg.1.anderson commented'dispatch-using-alias' can be handy, but it will fail if the alias is not defined on the remote machine. It therefore is not your best option if you are writing general-purpose code. Setting 'strict' => FALSE would be a better workaround.
Comment #5
moshe weitzman commentedWow, Drush Rebuild is quite nice. I think its simple text file could make it popular in a similar way that Make is popular. Since it is a new project, you might consider using YAML for the config file. Drush6 has native read/write support for it. If we were writing Make today, we would use YAML I think.
As for this issue, I agree with making db-url a global option. Done in 190a24abdb5e2156bc54671f4ffc12f5c13ade00.
Comment #6
kostajh commentedThanks Moshe!
I am actually using YAML for the config file, I need to update the Drupal.org docs. Check out Drush Rebuild 1.3 (https://drupal.org/node/2043137) when you have a chance.