Closed (fixed)
Project:
Configuration Provider
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
26 May 2020 at 20:28 UTC
Updated:
15 Jun 2020 at 20:44 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
a.dmitriiev commentedPatch with new plugin.
Comment #3
a.dmitriiev commentedUpdated patch with proper interface
Comment #4
nedjoThanks, this looks like a good start.
A config hash should be generated only for configuration that is provided by an extension, and, likely, only when the configuration is being prepped for writing as opposed to comparison.
So we may need some new methods in
ConfigNormalizerBaseparallel to existing ones. By calling both new methods, we ensure we're applying the normalization only as needed. Here are some quick and untested suggestions.A new method
::isProvideModeContext()parallel to::isDefaultModeContext():And a new method ::isProviderStorageContext() parallel to
::isActiveStorageContext(). Here, I guess, we test for the service ID of the Configuration Provider storage:Or, maybe better, we introduce a helper method:
and use that for both the new method and the existing one:
Comment #5
nedjoHmm. The approach I've suggested might not be right. Because config from Configuration Provider may already have been altered. For example, the module Config Actions Provider applies alters via Config Actions. We need to ensure we're generating the hash for the config in its pristine state as read from the
config/installorconfig/optionaldirectory. So, possibly, we should be doing this in Configuration Provider instead? As a new method inConfigProviderBasethat we call in bothConfigProviderInstallandConfigProviderOptional?Comment #6
a.dmitriiev commentedMaybe there is no need in new method, I searched for a way to modify the config and found this method
addConfigToCreatein ConfigProviderInterface. Now in both ConfigProviderInstall and ConfigProviderOptional it is empty and not doing anything, perhaps it is the place where we can modify$config_to_createand add the necessary properties?Comment #7
nedjoI haven't had a chance yet to look again at this, will update when I do. Meantime, moving to Configuration Provider issue queue.
Comment #8
a.dmitriiev commentedComment #9
a.dmitriiev commentedComment #10
a.dmitriiev commentedHere is the patch
Comment #11
a.dmitriiev commentedPatch is not working, need to debug more.
Comment #12
nedjoThanks for working on this!
::addConfigToCreate()is invoked at extension install time. Core already covers that case for adding a config hash to config fromconfig/installandconfig/optional.Where we need to work in this issue is :
:addInstallableConfig(), which is what's called to provide config toconfig_sync.Comment #13
a.dmitriiev commentedThanks, @nedjo.
Here is the new patch.
Comment #14
a.dmitriiev commentedComment #15
nedjoLooks good!
I haven't tested but please feel free to apply once you're confident it's working.
One note:
I believe in some cases a uuid is valid on extension-provided config, so perhaps we should be testing only for the second value.
Comment #16
a.dmitriiev commentedI found this issue https://www.drupal.org/project/drupal/issues/2628004 . While testing my patch, I saw that couple of even core modules also had no default_config_hash property, although they have the configs in config/install folder. That is why config_synchronizer updated them too and added missing property.
But maybe we also need to perform the checks like here is the patch https://www.drupal.org/files/issues/2628004-9.patch ? Checks on whether the config is config entity and whether there are any language overrides? Of course we are not updating all the configuration in the world, so maybe only language overrides is relevant here.
What do you think?
Updated patch without uuid check is attached.
Comment #17
nedjoYes. the default_config_hash is generated by core when extension-provided config is installed, so it should not be present in the
config/installfolder files.Hmm, good question. It's presumably true that we have a situation similar to that noted in #2628004: Create an upgrade path to determine if default_config_hash should be added (2625258): on existing sites running our module there may be config we installed that lacks a hash. I'd say:
Comment #18
a.dmitriiev commentedWith the patch in #16 config_sync import adds the default_config_hash property indeed and also to previously imported by config_sync configs from config/install and config/optional folders. So I am committing the fix. Let's fix other issues if they appear.
Thanks, @nedjo.
Comment #20
a.dmitriiev commented