Enable module dependencies of enforced config

Created on 17 January 2021, over 4 years ago
Updated 5 May 2023, about 2 years ago

Problem/Motivation

When deploying an enforced config for a newly added contrib module, a cache rebuild will fail unless you've previously enabled it with `hook_update_N()` or similar.

Steps to reproduce

  1. Require a new contrib module with Composer
  2. Enforce the new module's config
  3. Commit these changes and update an existing site
  4. Rebuild caches
  5. Observe a failure during config enforcement along the lines of:
    Drupal\Core\Config\ConfigImporterException: There were errors validating the config synchronization. Configuration foo.settings depends on the Antibot module that will not be installed after import.

Proposed resolution

Prior to importing an enforced config, determine whether all of its module dependencies are enabled. If not, enable them.

Remaining tasks

I suppose we might want to make this behaviour optional. So we should perhaps determine whether there are any downsides to this approach, or reasons not to want to.

User interface changes

TBD

API changes

TBD

Data model changes

TBD

Feature request
Status

Closed: duplicate

Version

1.0

Component

Code

Created by

🇨🇦Canada ergonlogic Montréal, Québec 🇨🇦

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇨🇦Canada ergonlogic Montréal, Québec 🇨🇦

    Based on experience since writing this ticket, enabling modules while importing configs seems fraught with danger.

    However, while the proposed implementation is lacking, the feature (managing dependencies) seems sound. In fact, it came up again recently on a project and, because we couldn't find this ticket at the time, we created Manage target modules' dependencies Active instead.

    In that ticket, we suggest resolving dependencies when writing configs and actively managing target modules' info.yml files.

    That seems like a better solution. So I'm closing this ticket as a duplicate.

Production build 0.71.5 2024