Config Import fails with: Deleted and replaced configuration "front_page.settings"

Created on 22 May 2024, about 1 month ago

Problem/Motivation

Importing configuration with drush config:import fails if no config is present for front_page module and a role gets deleted during configuration import (not related to this module).

Steps to reproduce

  1. Prepare configuration to import: front_page.settings.yml and user.role.***.yml which will cause the role to be deleted or update (delete and re-create)
  2. Ensure front_page.settings is not exist in config table in DB
  3. Run drush cim --partial
  4. [error] Drupal\Core\Config\ConfigException: Errors occurred during import in Drush\Drupal\Commands\config\ConfigImportCommands->doImport()

    In ConfigImportCommands.php line 324:

    The import failed due to the following reasons:
    Deleted and replaced configuration "front_page.settings"

Proposed resolution

front_page_user_role_delete removes rid_* key from the config, but if config was missing this creates a default config object. Before import this config was not present so config:import tries to create it but fails as config is already created when a role is deleted in the import process.

So, front_page_user_role_delete should check if config is present, and if not present don't try to remove a non-existent key from it and create the config as a side-effect.

πŸ› Bug report
Status

Needs review

Version

10.0

Component

Code

Created by

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.

  • Issue was unassigned.
  • Status changed to Needs review about 1 month ago
  • πŸ‡³πŸ‡΄Norway gisle Norway

    We need the community to review MR!16.

Production build 0.69.0 2024