Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Attempting to generate features for a bundle for which the configuration option "Include install profile" is selected triggers the following error:
Failed to package %package_name. Package not found.
Steps to reproduce:
- From a fresh Drupal standard install with the Features module installed, navigate to admin/config/development/configuration/features/bundle and create a new bundle, checking the box "Include install profile".
- Click the Features tab to navigate to admin/config/development/configuration/features. The error appears.
Cause of error: Previously, the profile was a structured array property of the FeaturesManager
object. Refactoring moved profile handling to the FeaturesBundle
object. However, the code section in FeaturesManager::assignConfigPackage()
that conditionally assigns config to a profile has not been updated and still references the now removed FeaturesManager::profile
property:
// Determine whether the profile is requested.
$profile =& $this->profile;
if ($package_name == $profile['machine_name']) {
$package =& $profile;
}
Proposed resolution
Remaining tasks
User interface changes
API changes
Comment | File | Size | Author |
---|---|---|---|
#10 | features-profile-2494763-10.patch | 14.05 KB | nedjo |
|
Comments
Comment #1
mpotter CreditAttribution: mpotter commentedHere is a patch that removes the old profile code you mentioned. Also does a simple refactoring in the AssignmentProfile plugin that will ensure the package exists.
However, I need real help here in testing how this is supposed to work. I haven't used the Profile creation stuff myself.
When the Bundles were added, I moved the Profile options into the Bundle settings. I think this makes sense, but I'm not sure having a package named for the profile itself still makes sense. I think something else is still confusing here.
Comment #2
mpotter CreditAttribution: mpotter commentedComment #3
mpotter CreditAttribution: mpotter commentedComment #4
mpotter CreditAttribution: mpotter commentedHrm, is something wrong with the testbot?
Comment #5
nedjoSome quick background here.
Previously (in config_packager), the profile wasn't itself a package (that is, it wasn't part of the packages array), but was modelled similarly to packages, in a structured array that included the same keys. So, for example, files could be added to the profile, including configuration files, and the profile could be regenerated like a package.
This seems to have been lost in the conversion of profile handling to bundles.
Comment #6
mpotter CreditAttribution: mpotter commentedRight. The old code for handling profiles was pretty patchy (similar to packages, but not quite). Moving it into bundles makes sense, but I think we just need to check the file generation. When exporting a feature that belongs to a profile bundle it should be adding the profile files if they don't yet exist. I think I understand the background...just need help getting the new bundle system to work for exporting features as profiles from somebody that understands that use-case. It's not something I ever expected to use Features for since a profile is a lot more than just a set of files and packages. Even Drupal is a bit confusing with profiles being treated as a kind of module/extension.
Can config be added to themes? If so, maybe we need a higher-level handling of "Extensions" rather than modules to handle all the types of things config can be added to.
I've committed the patch in #1 just to remove the old code that isn't used, but keeping this open to figure out how to better handle profiles.
Comment #8
nedjoI'll have a look at what's left to do here.
Comment #9
nedjoComment #10
nedjoThese changes are fairly extensive.
Background: in Configuration Packager, before it was merged into Features, I modelled the install profile separately from packages. Earlier in this issue, @mpotter began the work of refactoring so that the install profile is a special-cased package. This patch aims to compete that work.
The intended functionality is: when generating features, a site admin can choose whether to package them in an install profile. If this option is selected, generated features will be nested in 'profiles/[profilename]/modules'. If in addition the 'Profile' assignment plugin is enabled, a package will be generated for the install profile. If the install profile didn't already exist, it will be created drawing on code from core's standard install profile, including:
Currently, a number of issues are presenting, which this patch attempts to address:
type: module
in its info file rather thantype: profile
.Minor updates to the previous patch (better reuse of new method
FeaturesBundle::isProfilePackage()
).Comment #11
nedjoExplanation of some of the changes:
Unrelated filtering fix.
Since the renaming needs to happen via Drush as well as via the UI, moved this segment from the form to FeaturesGenerator::setPackageBundleNames().
Need to reset the full packages array so that deletions are registered.
We don't need to add files until just before generating.
An assignment plugin should be able to add files. Unsetting the files here removed files added by the profile assignment plugin.
This was the source of duplicate profiles being generated. We no longer need to handle the profile separately since it's handled as one of the packages.
Comment #13
nedjoThis completes the bulk of the refactoring. If and as further bugs show up we can open new issues.
Comment #16
nedjo