Problem/Motivation

drush config:export (cex) command fails on the site like the following.

  1. Uses Drush 9
  2. There are translations of config that are same language in "sync" and splits

For example, config directory is in the following state.

config
├── dev_split
│   └── language
│       └── ja
│           └── SOME_CONFIGS
└── sync
    └── language
        └── ja
            └── SOME_CONFIGS

When executing the drush config:export command, the following error occurs.

$ drush config:export -v -y

...

In FileStorage.php line 254:

  [UnexpectedValueException]
  FilesystemIterator::__construct(../config/sync/language/ja): failed to open dir: No such file or directory


Exception trace:
 FilesystemIterator->__construct() at web/core/lib/Drupal/Core/Config/FileStorage.php:254
 Drupal\Core\Config\FileStorage->deleteAll() at web/modules/contrib/config_filter/src/Config/FilteredStorage.php:190
 Drupal\config_filter\Config\FilteredStorage->deleteAll() at vendor/drush/drush/src/Drupal/Commands/config/ConfigExportCommands.php:142
 Drush\Drupal\Commands\config\ConfigExportCommands->doExport() at vendor/drush/drush/src/Drupal/Commands/config/ConfigExportCommands.php:91
 Drush\Drupal\Commands\config\ConfigExportCommands->export() at n/a:n/a
...

After that error, YAML files and "ja" dirs has been deleted.

Cause

The cause of the problem is that SplitFilter#filterGetAllCollectionNames() returns duplicate collection names.

On the above site, SplitFilter#filterGetAllCollectionNames() returns ['language.ja', 'language.ja'] .

Drush 9 attempts to delete all collections before exporting.
It attempts to delete language.ja twice, therefore an error occurs on the second deletion.

Drush 8 delete only the default collection, so the problem has not become obvious so far.

Related code of Drush

Proposed resolution

The problem is solved if SplitFilter#filterGetAllCollectionNames() returns unique collection names.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

masamoto created an issue. See original summary.

masamoto’s picture

Status: Active » Needs review
FileSize
677 bytes

I fixed and tested by the following versions.

  • config_split 8-x-1.x-dev
    Last commit: Wed Sep 26 16:01:36 2018 +0200 0ef6f0ca8629b89170b7142254c1ec2d76dd766d
  • Drupal 8.6.2
  • Drush 9.5.2
rrrob’s picture

Status: Needs review » Reviewed & tested by the community

Confirmed that this patch fixes the issue as described in the issue description.

bircher’s picture

Looks good, simple yet effective.
It would be great to have a test for this though.

  • bircher committed 9fba332 on 8.x-1.x
    Issue #3011363 by masamoto, rrrob: Config export fails on Drush 9 with...
bircher’s picture

Status: Reviewed & tested by the community » Fixed

Ok so no tests..
Thanks for the contribution!

Status: Fixed » Closed (fixed)

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