I have a config_split configuration with name Development and folder ../config/dev
When I export the config with drush csex now the config is exported to ../config/dev/dev. It seems a collection is determined and that collection name is appended to that folder. Changing the folder to e.g. config/devtest makes sure the config is exported to config/devtest/dev. I do not understand where the dev collection comes from.

This is the config_split config:

uuid: null
langcode: nl
status: false
dependencies: {  }
id: development
label: Development
folder: ../config/dev
module:
  devel: 0
  devel_generate: 0
  field_ui: 0
  kint: 0
  views_ui: 0
theme: {  }
blacklist:
  - field_ui.settings
  - devel.settings
  - devel.toolbar.settings
  - system.menu.devel
graylist: {  }
graylist_dependents: true
graylist_skip_equal: true
weight: 0

Comments

daften created an issue. See original summary.

daften’s picture

Related to this, I now something get errors like this:

Do a normal (including filters) config export? (y/n): y
exception 'UnexpectedValueException' with message 'FilesystemIterator::__construct(../config/dev/dev): failed to open dir: No[error]
such file or directory' in /Users/daften/Workspaces/Freelance/AV/site/web/core/lib/Drupal/Core/Config/FileStorage.php:254
Stack trace:
#0 /Users/daften/Workspaces/Freelance/AV/site/web/core/lib/Drupal/Core/Config/FileStorage.php(254):
FilesystemIterator->__construct('../config/dev/d...')
#1 /Users/daften/Workspaces/Freelance/AV/site/web/modules/contrib/config_filter/src/Config/FilteredStorage.php(182):
Drupal\Core\Config\FileStorage->deleteAll('')
#2 /Users/daften/Workspaces/Freelance/AV/site/web/modules/contrib/config_split/src/ConfigSplitCliService.php(162):
Drupal\config_filter\Config\FilteredStorage->deleteAll()
#3 /Users/daften/Workspaces/Freelance/AV/site/web/modules/contrib/config_split/config_split.drush.inc(83):
Drupal\config_split\ConfigSplitCliService->export(NULL, NULL)
#4 [internal function]: drush_config_split_export()
#5 /Users/daften/Workspaces/Freelance/AV/site/vendor/drush/drush/includes/command.inc(422):
call_user_func_array('drush_config_sp...', Array)
#6 /Users/daften/Workspaces/Freelance/AV/site/vendor/drush/drush/includes/command.inc(231): _drush_invoke_hooks(Array, Array)
#7 [internal function]: drush_command()
#8 /Users/daften/Workspaces/Freelance/AV/site/vendor/drush/drush/includes/command.inc(199):
call_user_func_array('drush_command', Array)
#9 /Users/daften/Workspaces/Freelance/AV/site/vendor/drush/drush/lib/Drush/Boot/BaseBoot.php(67): drush_dispatch(Array)
#10 /Users/daften/Workspaces/Freelance/AV/site/vendor/drush/drush/includes/preflight.inc(66):
Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#11 /Users/daften/Workspaces/Freelance/AV/site/vendor/drush/drush/drush.php(12): drush_main()
#12 {main}
daften’s picture

Priority: Normal » Major

The module functionality is completely broken now because of this.
It seems related to the changes done for incorporating config_filter

bircher’s picture

This seems to be indeed a quite strange bug.

First of all thanks for sharing the configuration and the detailed error message.

Just to rule out other factors, does drush cex work? And do you have other modules that mess with configuration? Can you reproduce it on a fresh installation? I don't know where the extra directory/collection would come from.

neoxavier’s picture

+1,

my config_split.config_split.dev.yml is

uuid: f4db28a4-a58c-4df6-8948-f1bec5dca3c5
langcode: en
status: false
dependencies: {  }
id: dev
label: dev
folder: ../configs/env/dev
module:
  field_ui: 0
  views_ui: 0
theme: {  }
blacklist: {  }
graylist: {  }
graylist_dependents: true
graylist_skip_equal: true
weight: 0

I got the same issue.
In my case, my folder was ../configs/env/dev
when I did

drush csex dev, it created ../configs/env/dev/env

I tried with 8.3 and 8.4 and dev version as well

I also think that config_filter is the reason.

bobbygryzynger’s picture

StatusFileSize
new15.62 KB
new56.53 KB

I am also seeing this issue appear on exports using 1.0.0-beta6. I am able to reproduce it using the following steps.

1. Sync the database from my remote development environment, which has config_split enabled and configured as follows:

uuid: ef27b820-dd16-4c89-93e1-fd70c58e061b
langcode: en
status: false
dependencies: {  }
id: dev
label: Dev
folder: ../config/<site>/dev
module:
  shield: 0
theme: {  }
blacklist: {  }
graylist: {  }
graylist_dependents: true
graylist_skip_equal: true
weight: 1

2. Enable my development environment split locally via settings.php:
$config['config_split.config_split.dev']['status'] = TRUE;

3. Log on to the site and add an additional module to my dev split (for the purpose of illustration I added the search module).

4. Run drush @local_alias cex (drush 8.1.10). Here, the output is:

Collection  Config                         Operation
             core.extension                 update
             config_split.config_split.dev  update

5. When the export completes, I get the following directory structure (showing split directories for other environments):
post-export

Prior to export, the directory looked like this:
pre-export

The updated and exported config_split configuration file looks like this:

uuid: ef27b820-dd16-4c89-93e1-fd70c58e061b
langcode: en
status: false
dependencies: {  }
id: dev
label: Dev
folder: ../config/<site>/dev
module:
  search: 0
  shield: 0
theme: {  }
blacklist: {  }
graylist: {  }
graylist_dependents: true
graylist_skip_equal: true
weight: 1

From what I can tell, it doesn't seem that I'm doing anything too out of the ordinary here. I am also using config_ignore in conjunction with config_split and I am using config_filter 1.0.0-rc1.

Please let me know if any additional information would be helpful in tracking the cause of this issue down.

bobbygryzynger’s picture

Version: 8.x-1.0-beta4 » 8.x-1.0-beta6
bobbygryzynger’s picture

StatusFileSize
new88.18 KB

It seems there may be some unexpected interaction with config_ignore here. If I go to the configuration UI I see that shield.settings and core.extension are showing up as part of my config_ignore settings.
config ui

This is despite config_ignore being configured as follows:

ignored_config_entities:
  - 'webform.webform.*'
bobbygryzynger’s picture

StatusFileSize
new45.7 KB
bircher’s picture

Ok so this is apparently still happening and I have no good way to debug it.

I created https://github.com/bircher/config_split_debug which is very similar to the setup in which I develop config_split and somewhat similar to the project setup we use at Nuvole.

Please fork it and modify your fork to the point that this pesky bug can be reproduced.
Then I will have the same environment and setup and I can step though it with xdebug.

Thanks for your collaboration.

bobbygryzynger’s picture

@bircher, thanks for your responsiveness here. I haven't been able to reproduce the extra directories issue on a fresh install. But I have been able to reproduce the UI issue where split entities are being listed as ignored entities. I've opened a new issue here for this.

bircher’s picture

Hi, thanks for tying to reproduce the bug.

I just saw the following: https://github.com/bobbygryzynger/config_split_debug/commit/96b58ceec426...

This practice could indeed lead to the split having/being a collection and messing up the export after an import.
A config directory contains all the config in yaml files and all the collections in folders that contain the collections overrides. This is how \Drupal\Core\Config\FileStorage works and we have to accept that.

So a split directory is also a FileStorage, and consequently it is not a good idea to have a FileStorage in the same path of another FileStorage. Otherwise the outer FileStorage will read the inner one as a collection. I guess you have not worked on a multilingual site or you would have seen the language directories there.

The split directory should be in a sibling directory of the sync directory. I will add a warning in the field description.

If the other issue reporters could comment on it and also reveal the location of the sync directory then maybe we can pin it down to that and it becomes a documentation issue.

bobbygryzynger’s picture

@bircher, thanks for clarifying this.

I do have a follow up question then: is it possible to to create a directory structure where there is a directory for splits that is a sibling of the sync directory, but this directory contains subdirectories where the config files are stored? As in:

config
│
└──sync
│      config.yml
│      ...
│  
└──splits
   │
   └──dev
   │      config.yml
   │      ...
   │
   └──prod
          config.yml
          ...

It seems that #5 is taking this approach. Is this also necessarily problematic because of the reasons you stated?

The use-case I am trying to solve here is for a multisite installation. Ideally, based on your comment above, I'd like to structure the directories like this, where each multisite can have its own splits:

config
│
└──default
│    config.yml
│     ...
│
└──multisite
│    config.yml
│     ...
│
└──splits
   │
   └──default
   │  │
   │  └──dev
   │  │    config.yml
   │  │    ...
   │  │
   │  └──prod
   │  │    config.yml
   │  │    ...
   │  │
   └──multisite
      │
      └──dev
      │    config.yml
      │    ...
      │
      └──prod
           config.yml
           ...

If this isn't workable, do you have any suggestions for how split directories can be structured so that they may be further divided to support this sort of usage?

bircher’s picture

Yes both options are absolutely possible, almost anything should work so long as you don't nest file storages within each other. The folder containing config in yml should not contain other config folders, split or otherwise.

bobbygryzynger’s picture

Thanks @bircher, the configuration above, with subdirectories of a splits directory, is working well for our use-case.

  • bircher committed be01de5 on 8.x-1.x
    Issue #2863919 by bobby.gryzynger, bircher: collection inside of the...
bircher’s picture

Status: Active » Fixed

There has been no activity in a month.
It seems the error stemmed from using the split directory inside the the sync directory. So I added a warning now and I guess this can be closed now.

froboy’s picture

I also ran into the above issue, coming to config_split via https://www.jeffgeerling.com/blog/2017/adding-configuration-split-drupal.... I've sent a comment to Jeff requesting he update the post to reflect the requirements above.

I can confirm that i saw the issue with my split config nested in the existing config directory and everything works fine when it's moved to a sibling as per #2863919-13: I get the collection inside of the config split directory.

imclean’s picture

This prevents some valid split directories such as config_live as a sibling of sync directory. For example, sync directory is sites/default/config the sites/default/config_dev and sites/default/config_live would both be invalid. Follow up: #2899516: Improve split folder validation

There's no patch here so it wasn't immediately obvious.

thaddeusmt’s picture

I was running in to this too, and fixed it my moving the "split" storage directory outside of the "sync" directory.

The instructions in the admin UI say "The directory, relative to the Drupal root, to which to save the filtered config. Recommended is a sibbling directory of what you defined in $config_directories[CONFIG_SYNC_DIRECTORY] in settings.php"

This appears to be bad advice, so maybe it should be changed.

  • bircher committed 79126a8 on 8.x-1.x
    Issue #2863919: Improve readme to warn about placements of config...

Status: Fixed » Closed (fixed)

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

landsman’s picture

this is really done? can someone open this issue again?

radimklaska’s picture

Hi friends! :-)

I just experienced the same problem - I can confirm that moving split directories out of the main config directory solves the problem.

albertski’s picture

I just ran into the same issue.

Originally it imported to the ../config/dev module but now it is exporting to ../config/dev/dev.

I think all I did was install a new module and uninstall it and then update a view.

I debugged SplitFilter->getSecondaryStorage() and the $directory is correct (../config/dev) but still config is outputting to ../config/dev/dev. If anyone has any idea where to look I can help with making a patch to fix this.

albertski’s picture

@thaddesumt's solution of moving outside of sync directory fixed the issue for me.

I originally had:

$config_directories[CONFIG_SYNC_DIRECTORY] = '../config';

I had my split directories at:

../config/dev
../config/prod

Now I updated to:

$config_directories[CONFIG_SYNC_DIRECTORY] = '../config/sync';

And my split directories stay the same (outside of the sync directory):

../config/dev
../config/prod