Drush CEX not exporting

Created on 21 February 2019, almost 6 years ago
Updated 20 March 2023, over 1 year ago

Could be related to https://www.drupal.org/project/config_split/issues/3003108#comment-12959107 β†’ as arakwar appears to be seeing the same behavior.

His comment is:

I do not know if it's related, but in my setup (Drupal8/Drush9), "cex" fails to use config_split settings while "csex" use them properly.

To me, it feels like config_split doesn't hook properly on "cex" in Drush9 anymore. Since "csex" works we just stopped using the "cex" command for now.

My situation on Drush on 9.5.2:

Settings File

/**
 * Set up splits and other items that can't go in the .env file.
 */
switch ($env) {
  case ENV_LOCAL:
    $config['config_split.config_split.local']['status'] = TRUE;

    break;

  case ENV_DEVELOPMENT:
    $config['config_split.config_split.dev']['status'] = TRUE;

    break;

  case ENV_STAGE:
    $config['config_split.config_split.stage']['status'] = TRUE;

    break;

  case ENV_PROD:
    $config['config_split.config_split.prod']['status'] = TRUE;

    break;
}

Config Split Configuration

Five splits: Local (for development), Dev (hosted), Stage (hosted), Prod (hosted), From_prod (if changes are made on prod by content team).

I'm performing this on a development machine, which has only the Local split active; all others are inactive.

I chose the modules that are to be active in each split and saved them. I note that the README says the following:
"You should only edit active splits as inactive splits will not take effect when exporting the configuration."

Exporting

Case 1: With everything inactive except for the local split, I run 'drush cex.'

Expected Result: This should export the Config Split configuration and the config for the Local split because only the Local split is active.

Actual Result: The Config Split config is exported to the sync directory and nothing else. Note that the documentation says this should work in Drush 9.

Case 2: I enable all splits via the UI because of the README instruction. The status shows "inactive (overwritten)" for Dev, Stage and Prod. Local and From_prod show as active. I run 'drush cex.'

Expected Result: The Config Split configuration and the config for all splits should be exported since I have enabled all the splits via the UI.

Actual Result: Config Split configuration is exported but nothing else.

Case 3: Disable all the splits again except for the Local split. Run 'drush csex dev.'

Expected Result: Split configuration is exported to the Dev split.

Actual result: I'm asked:

The following directories will be purged and used for exporting configuration:
profiles/<site>/config/splits/dev
Export the configuration? (yes/no) [yes]:

When I respond with yes, the configuration is written to the Dev split; no Config Split configuration is written to sync (as expected).

Summary

It appears that with Config Split 1.4 and Drush 9.5.2, the following is true:

  1. 'drush cex' exports Config Split config into sync but does not actually write the other config to any of the splits whether or not the split has been enabled in the UI.
  2. 'drush csex ' writes the proper config to the named split

My understanding from the documentation is that 'drush cex' should perform both items above when the split has been activated in the UI.

Thus, this appears to be a bug. The workaround is to use 'drush cex' followed by 'drush csex ' for each split.

πŸ› Bug report
Status

Active

Version

1.4

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States aangel

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.

  • First commit to issue fork.
Production build 0.71.5 2024