Config Distro breaks with Drush 12, need to refactor not to use ConfigImportCommands

Created on 24 June 2023, about 1 year ago
Updated 11 August 2023, 11 months ago

Problem/Motivation

Attempting to use drush cim or drush anything with Drush 12 causes fatal errors due to the change described here https://github.com/drush-ops/drush/issues/5626

The error message given is:

You have requested a non-existent parameter "config.import.commands".

Remaining tasks

Refactor usage of ConfigImportCommands to rely to use Drupal's APIs.

This Merge Request adds possible breaking changes for anyone extending this module.
1. Moved drush command into a Drush folder from the Commands folder (following Drush 12 convention)

Additionally, could cause some update pain.
1. Drops support for Drush 10 and below. (previously Drush 9 through 11)

πŸ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States mlncn Minneapolis, MN, USA

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

Comments & Activities

  • Issue created by @mlncn
  • πŸ‡¨πŸ‡­Switzerland bircher πŸ‡¨πŸ‡Ώ

    I think using Drupal's API is the better choice. We can fork the config import command and adjust it to our needs, depending on how much of the things in it we need.

    The only thing that it does differently than the drupal UI is shown the diff based on the diff of exported config to two temporary directories.
    Maybe that is something that drush could do in a trait we could use... but that would mean requiring a yet unreleased version of drush. So in the meantime I would just fix this here. Config Split could use such a trait too and possibly other modules too.

  • First commit to issue fork.
  • @trackleft2 opened merge request.
  • πŸ‡ΊπŸ‡ΈUnited States trackleft2

    For changes I referenced the following documentation:

    Structure of a service file β†’

    Creating Custom Commands

  • First commit to issue fork.
  • Status changed to Needs work 11 months ago
  • πŸ‡ΊπŸ‡ΈUnited States joegraduate Arizona, USA

    Setting to needs work for MR comments / suggestions

  • πŸ‡ΊπŸ‡ΈUnited States trackleft2
  • πŸ‡ΊπŸ‡ΈUnited States trackleft2

    Let's not introduce the Service folder convention here, as it will be a breaking change for no reason.

  • πŸ‡ΊπŸ‡ΈUnited States trackleft2
  • Status changed to Needs review 11 months ago
  • πŸ‡ΊπŸ‡ΈUnited States joegraduate Arizona, USA
  • πŸ‡ΊπŸ‡ΈUnited States joegraduate Arizona, USA

    Thanks @trackleft2 for working on this!

    I've tested MR !6 in conjunction with the config_sync MR for πŸ› Config Sync breaks with Drush 12, need to refactor not to use ConfigImportCommands Fixed and verified that:

    • The `drush cd-update` command still works as expected with both Drush 11 and Drush 12
    • config_sync's tests still pass

    I think it would be good to commit this change and include it in a new 2.0.x release so that config_sync can require the new version as part of the fix for πŸ› Config Sync breaks with Drush 12, need to refactor not to use ConfigImportCommands Fixed .

    @tadean is also planning to review / test this so not marking this RTBC yet.

  • πŸ‡ΊπŸ‡ΈUnited States joegraduate Arizona, USA

    I've tested MR !6 again (after all the recent changes) and verified that:

    • The `drush cd-update` command still works as expected with both Drush 11 and Drush 12
    • config_sync's tests still pass
  • πŸ‡ΊπŸ‡ΈUnited States joegraduate Arizona, USA

    Spoke to @tadean about this. We both think it'd be better to move the config import code from the new free-standing ConfigDistroImporter service introduced by this MR into a private method in the Drush command class for now since it currently relies on the Drush logger (so isn't particularly useful as a free-standing service for anything other than drush commands). Having the code in a private method for now also has the benefit of making it easier to change in the future.

    I've done this refactoring in a local working copy of the MR branch and will push up the changes shortly.

    I've also verified that the following things still work after refactoring:

    • The `drush cd-update` command still works as expected with both Drush 11 and Drush 12
    • config_sync's tests still pass
  • Thanks for all the promising work on this issue! I tested the refactored config-distro-update command against Drush 12.1.2, used in conjunction with the related patch from the config_sync issue πŸ› Config Sync breaks with Drush 12, need to refactor not to use ConfigImportCommands Fixed to avoid the similar error and was able to import configuration changes from a custom module without error:

    $ drush config-distro-update
    +------------+---------------------------+-----------+
    | Collection | Config                    | Operation |
    +------------+---------------------------+-----------+
    |            | node.type.my_content_type | Update    |
    +------------+---------------------------+-----------+
    
     Import the listed configuration changes? (yes/no) [yes]:
     > yes
    
     [notice] Synchronized configuration: update node.type.my_content_type.
     [notice] Finalizing configuration synchronization.
     [success] The configuration was imported successfully.

    I verified manually that the configuration seemed to be imported correctly.

  • Status changed to Fixed 11 months ago
  • πŸ‡ΊπŸ‡ΈUnited States joegraduate Arizona, USA

    Merged into 2.0.x branch. Thanks all!

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

Production build 0.69.0 2024