Guardr profile cannot be installed due to use of hook_install()

"drush site-install guardr" fails.

Error -

In install.core.inc line 2287:

[Drupal\Core\Installer\Exception\InstallerException]
Configuration install: guardr

The selected profile has a hook_install() implementation and therefore can
not be installed from configuration.

It appears we need to use the "Allow an install hook in profiles installing from configuration" patch.

https://www.drupal.org/project/drupal/issues/2982052
https://www.drupal.org/project/drupal/issues/2982052#comment-12872437

Add this to composer.json

        "drupal/core": {
            "2982052 - Allow an install hook in profiles installing from configuration": "https://www.drupal.org/files/issues/2018-11-27/2982052-22.patch"
        }

Example failure:
https://travis-ci.com/guardrdistro/guardr-project/jobs/216204039

CommentFileSizeAuthor
#4 guardr-3071339-4.patch732 bytesshrop

Comments

joestewart created an issue. See original summary.

shrop’s picture

Noting that #2357215: Clean up hook_install() in Standard Install Profile may help too. Guardr is using hook_install() code from the standard Drupal profile so once this is cleaned up, we can just pull those changes in, I believe. Sound right, @joestewart?

shrop’s picture

Status: Active » Needs review
StatusFileSize
new732 bytes

Description

Got the error on install Joe mentioned above:

⇒  ddev exec drush si --account-name=admin --account-pass=admin --account-mail=admin@example.com --site-name=Guardr8 --site-mail=admin@example.com guardr
You are about to DROP all tables in your 'db' database. Do you want to continue? (y/n): y
Starting Drupal installation. This takes a while. Consider using the --notify global option.                                                                               [ok]
Drupal\Core\Installer\Exception\InstallerException: Configuration install: guardr                                                                                          [error]

The selected profile has a hook_install() implementation and therefore can not be installed from configuration. in /var/www/html/web/core/includes/install.core.inc:2289
Stack trace:
#0 /var/www/html/web/core/includes/install.core.inc(1095): install_display_requirements(Array, Array)
#1 /var/www/html/web/core/includes/install.core.inc(709): install_verify_requirements(Array)
#2 /var/www/html/web/core/includes/install.core.inc(584): install_run_task(Array, Array)
#3 /var/www/html/web/core/includes/install.core.inc(125): install_run_tasks(Array, NULL)
#4 /var/www/html/vendor/drush/drush/includes/drush.inc(728): install_drupal(Object(Composer\Autoload\ClassLoader), Array)
#5 /var/www/html/vendor/drush/drush/includes/drush.inc(713): drush_call_user_func_array('install_drupal', Array)
#6 /var/www/html/vendor/drush/drush/commands/core/drupal/site_install.inc(82): drush_op('install_drupal', Object(Composer\Autoload\ClassLoader), Array)
#7 /var/www/html/vendor/drush/drush/commands/core/site_install.drush.inc(271): drush_core_site_install_version('guardr', Array)
#8 /var/www/html/vendor/drush/drush/includes/command.inc(422): drush_core_site_install('guardr')
#9 /var/www/html/vendor/drush/drush/includes/command.inc(231): _drush_invoke_hooks(Array, Array)
#10 /var/www/html/vendor/drush/drush/includes/command.inc(199): drush_command('guardr')
#11 /var/www/html/vendor/drush/drush/lib/Drush/Boot/BaseBoot.php(67): drush_dispatch(Array)
#12 /var/www/html/vendor/drush/drush/includes/preflight.inc(67): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#13 phar:///usr/local/bin/drush/bin/drush.php(153): drush_main()
#14 /usr/local/bin/drush(10): require('phar:///usr/loc...')
#15 {main}

Next steps

  • Confirm fix by testing install
  • Commit
  • Create a related follow up issue to remove patch when not needed once the core issues are fixed (sound reasonable?)

Testing steps

* git clone --branch 8.x-1.x git@git.drupal.org:project/guardr.git
* composer install
* Install Drupal using the Guardr profile and confirm no errors result

drupalninja99’s picture

Additional steps I took:
- wget -q -O - https://www.drupal.org/files/issues/2019-08-12/guardr-3071339-4.patch | git apply
- composer update drupal/core
- I removed the from guardr/config/sync folder and removed the sync configuration setting from settings.php after getting a synchronization error (not sure where this gets set?)
- After that guardr installed successfully.

shrop’s picture

@drupalninja99 hypothesizes that the patch for core for this issue is conflicting with the config/sync folder being created by the Drupal Scaffolding. Maybe we can remove that setup from the scaffolding.

Also, we discussed that it might make sense to test and commit #3052298: Update Guardr to core 8.7.0 first and then come back to this so we don't have to update 8.7.0 in testing steps at least.

drupalninja99’s picture

After applying and committing the Drupal 7 patch to composer/lock I reapplied this patch, ran composer update and it looks like now config/sync is added to the docroot and not until install which means we don't have the problem we had previously. Before there was a README created inside a sync folder within guard/config which was causing the issue. I can confirm that with both updates I can install guardr successfully.

shrop’s picture

Now that #3052298: Update Guardr to core 8.7.0 has been committed, I think testing this is a bit easier

astrocling’s picture

Status: Needs review » Reviewed & tested by the community

I tested this using the following instructions and was able to get the site to install correctly.

Testing steps
* git clone --branch 8.x-1.x git@git.drupal.org:project/guardr.git
* composer install
* Install Drupal using the Guardr profile and confirm no errors result

Based on those testing instructions I believe this is good to go.

  • shrop committed deada66 on 8.x-1.x
    Issue #3071339 by shrop, joestewart, drupalninja99, astrocling: Guardr...
shrop’s picture

Status: Reviewed & tested by the community » Fixed

Description

Thanks for all the testing!
I committed the patch
Noting that the same patch is also available in https://github.com/guardrdistro/guardr-project/blob/8.x/composer.json

Status: Fixed » Closed (fixed)

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