A different form class is swapped for the 'install_configure_form' step.
That class uses a different form_id (config_installer_site_configure_form)
This breaks the drush site-install --account-name=* --account-pass=* --account-mail=* options, since drush takes those values and assigns these as values in $settings['install_configure_form.account.*'] (see drush_core_site_install_version() in drush/commands/core/drupal/site_install.inc), so that the installer task runner assigns the values to the form (by form ID).
So a CLI install command for the config_installer profile reads :
drush si config_installer -y --notify --account-name=admin --account-pass=admin \
config_installer_site_configure_form.account.name=admin \
config_installer_site_configure_form.account.pass.pass1=admin \
config_installer_site_configure_form.account.pass.pass2=admin \
config_installer_site_configure_form.account.mail=foo@bar.bz(--account-name and --account-pass are inactive, but still need to be specified so that the message printed at the end of the install is accurate)
Is there any way config_installer's SiteConfigureForm could keep the same 'install_configure_form' form ID, so that the native --account-* args still work with drush si ?
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | drush_site_install-2495935-12.patch | 934 bytes | jcnventura |
| #6 | config_installer_drush_site_install-2495935-6.patch | 1.73 KB | nlisgo |
Comments
Comment #1
yched commentedComment #2
webflo commentedWe could call
$account_pass = drush_get_option('account-pass', drush_generate_password());and$account_name = drush_get_option('account-name', 'admin');inside of config_installer's SiteConfigureForm.Comment #3
yched commented@webflo : well, calling drush functions that fetch drush context from within an install profile is kind of hackish... 'drush site-install' has dedicated mechanisms to pass values to the installation forms.
Maybe instead of declaring its own separate form, config_installer should alter the existing one, so that the form_id stays the same ?
Comment #4
alexpottWhen doing a site-install with Drush the config_installer is not treated like a real module so it would not be able to implement form alters :(. What is weird about this is that it is treated like a real module when doing an interactive install - see the fix for the config import batch steps in #2512700: Profiles are causing a problem whilst installing modules.
I think the best we can do here is either #2 which is hacky but with a function_exists() will work nicely or just add documentation on how to do it properly.
Comment #5
yched commentedform_alters : I thought that was how other profiles did it ? config_installer switching a different form / form_id seems pretty rare ?
But yeah, #2 is probably good enough if it does the job.
I guess the underlying issue is that our whole install process, including in drush, is still form-based rather than API-based. So passing values from drush site-install currently means passing values to a specific form with a specific form_id, which then can vary depending on the profile being installed.
Comment #6
nlisgo commentedJust supplying a patch for the approach in #2 that is working for me. The profile is working great for me.
Comment #7
jcnventura#6 worked fine for me. I'd mark it RTBC, had nlisgo marked it for review already.
Comment #8
jcnventuraOK. So it seems there's no tests.
Comment #9
alexpottRe #8 there are tests but install profile tests cannot be run on DrupalCI (they didn't run on pifr/pift either) and yep this patch broke the tests because #default_value does not work with password_confirm form fields - Drupal just breaks horribly.
With the patch in #6...
With what I have committed...
Comment #12
jcnventuraJust a (tiny) bug in your patch, which unfortunately makes it non-functional.
Comment #14
alexpottOpps and thanks @jcnventura
Comment #15
netamorfose commentedI am experiencing an InstallerException.
I executed this exact command
Trying with the following combinations:
1) Core 8.0.0 with drush 8.0.0
2) Core 8.0.1 with drush 8.0.1
both results in the same error:
But commenting this lines out http://cgit.drupalcode.org/config_installer/commit/?id=de55e65 it works.
Comment #16
alexpott@netamorfose what happens if you do
../vendor/bin/drush si config_installer -y --account-name=admin --account-pass=adminwith this change it shouldn't be necessary to pass anything specific for the config_installer_site_configure_formComment #17
andrewsuth commented@alexpott thanks for the clarification. I can confirm that it works as you outlined in #16