Hello,

When I try to revert my features with Drush. The wrong configuration files are imported.

My use case, I am developing a distrib for french Drupalcamps : https://github.com/Drupal-FR/socle-drupalcampfr

In my installation profile I have exported system.theme.yml with the good theme values.

But if I import the features: $DRUSH features-import -y --force --bundle=drupalcampfr drupalcampfr

It is the configuration from core/modules/system/config/install/system.theme.yml which is imported.

Note: I use the --force option because some components don't want to be reverted but even with that I still get some features marked as overriden... But it is another problem.

I will try to see why I have this behaviour.

Comments

Grimreaper created an issue. See original summary.

Grimreaper’s picture

I tracked the problem.

In drush/features.drush.inc, drush_features_import():

else {
              // Revert existing component.
              /** @var \Drupal\features\ConfigurationItem $item */
              $item = $config[$component];
              $type = ConfigurationItem::fromConfigStringToConfigType($item->getType());
              $config_revert->revert($type, $item->getShortName());
              drush_log(dt('Reverted @module : @component.', $dt_args), 'ok');
            }

In the $config, I have a key system.theme well set, and detected from my installation profile with the good values. (EDIT: not the good values, the values from the active configuration)

So it is in the service from config_update called in:

$config_revert->revert($type, $item->getShortName());

That the import is not done on the right file.

Should I put this issue into config_update issue queue? Or should this be handled in Features?

Note: I don't know if it is already into an issue but the function drush_features_list() doesn't exist.

nedjo’s picture

nedjo’s picture

I don't know if it is already into an issue but the function drush_features_list() doesn't exist.

Good catch. Please open a new issue.

Grimreaper’s picture

Hello nedjo,

Issue open for drush_features_list(): #2672682: Undefined function drush_features_list()

I will see the next weekend about the related issue in config_update, thanks.

Grimreaper’s picture

I continue to search the source of the problem. There is something interesting.

If I isolate the case of system.theme.yml

In core/lib/Drupal/Core/Config/FileStorage.php read():

$filepath = $this->getFilePath($name);

returns core/modules/system/config/install/system.theme.yml after a direct call from the revert() function in ConfigReverter.php

But later in the revert() function:

$this->configFactory->getEditable($full_name)->setData($value)->save();

triggers an event and a LocaleConfigManager call read() of FileStorage.php and then it is the good filepath (and data) which is returned: profiles/custom/drupalcampfr/config/install/system.theme.yml

I wonder if I should continue research to find the origin of the problem or if I should create a service to revert with Drush.

Grimreaper’s picture

If I try to revert in Features UI my theme settings, I have the same problem.

It is the file from core/modules/system/config/install/system.theme.yml which is read.

EDIT: If I put my system.theme.yml into a features module then the revert works. So I will check for profile conditions into Features.

Grimreaper’s picture

Title: Wrong config files imported with Drush » Wrong config files imported

Renaming the issue title has it also does not work in the UI.

Grimreaper’s picture

Issue summary: View changes

Editing git repository URL.

Grimreaper’s picture

Status: Active » Closed (won't fix)

Hello,

I have tested the 8.3.0-beta8 version.

If in features/src/FeaturesManager.php initPackageFromExtension(), I replace:

$short_name = $extension->getName();

with

$short_name = $bundle->getShortName($extension->getName());

Which corresponds to a revert of #2745023: Features Drush commands are using shortname instead of the expected module name (fullname).

It works.