The Configuration Management needs a stronger API to provide better re-usability and encapsulation for its process.
As first step I think we need to focus on configuration files import and export scenarios. So we need to provide functions and /or wrappers that will cover:

  • Export activestore configurations to files.
  • Export datastore configurations to files
  • Import configurations files into activestore
  • Import configurations files into datastore
  • Import configurations files into activestore and datastore

Once we have this set of functions the drush command implementation will be transparent so we do not need to focus in that right now, but for now I will be also implementing drush command for testing purposes too.

Comments

gdrupal’s picture

This is my first approach to cover "Import configurations files into activestore". This patch works for the actual functionality of importing a previously exported tar but.... it still need a lot of work since I noticed (testing the function as a drush command) that there are several dependencies here and there, so not a fully independent functionality yet.

gdrupal’s picture

Status: Needs work » Needs review
StatusFileSize
new24.07 KB

Well finally here is it the 1st function wrapper for "Import configurations files into activestore". I have tested it from the command line and in a profile install process. I have encountered a really strange issue triggered by the hook_init() implementation so I added a workaround. The root of this problem is in a drupal core limitation about cache (it uses a fake cache class) in the profile install process.

We have the new configuration_import_files($path) function, where $path is the path to a local directory with previously exported configuration files. So now, we can have our configurations along with our drupal profile and pull them in the install process or by a script from the command line.

Hook_install Code example:

/**
 * Implements hook_install().
 *
 * Perform actions to set up the site for this profile.
 */
function profilename_install() {
  if (module_exists('configuration')) {
    configuration_import_files(drupal_get_path('profile', 'profilename') . '/configuration/');
  }
}

Drush Command Code example:
drush cimp profiles/profilename/configuration/

lucascaro’s picture

Category: task » feature

Status: Needs review » Needs work

The last submitted patch, better-configuration-management-api-1671404-2.patch, failed testing.

dagmar’s picture

Status: Needs work » Needs review
StatusFileSize
new5.13 KB

Re-rolled.

dagmar’s picture

StatusFileSize
new8.43 KB

I forgot to add the configuration.admin.inc file in the patch.

lucascaro’s picture

Status: Needs review » Needs work

I'd like some tests for this new functionality before committing, any volunteers? :)

Also, usually we want to add an empty new line at the end of every file to avoid error messages when applying the patch:

+++ b/configuration.drush.inc
@@ -0,0 +1,69 @@
\ No newline at end of file

+++ b/configuration.module
@@ -1093,4 +1094,56 @@ function configuration_hook_info() {
\ No newline at end of file
gdrupal’s picture

StatusFileSize
new8.53 KB

Here is a little fix before we start working on a test case. Seems that we need a default configuration set of files for testing purposes that should cover all type of components or something like that.

gdrupal’s picture

Status: Needs work » Needs review
gdrupal’s picture

Status: Needs review » Needs work
dagmar’s picture

Status: Needs work » Needs review

#8: 1671404.better_api.8.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, 1671404.better_api.8.patch, failed testing.

dagmar’s picture

This needs to be re-rolled

gdrupal’s picture

Status: Needs work » Needs review
StatusFileSize
new8.54 KB

Re-rolled.

lucascaro’s picture

Issue tags: +Needs tests

I know @GDrupal is working on tests for this so the tag is only for organizing the issue queue.

lucascaro’s picture

Issue tags: -Needs tests

#14: 1671404.better_api.14.patch queued for re-testing.

Status: Needs review » Needs work
Issue tags: +Needs tests

The last submitted patch, 1671404.better_api.14.patch, failed testing.

gdrupal’s picture

Status: Needs work » Needs review
StatusFileSize
new31.41 KB

Here is the patch with the import files wrapper, drush command feature and test cases. The test cases are commented until we fix this issue:
http://drupal.org/node/1698428

lucascaro’s picture

Issue tags: -Needs tests

#18: better-api-1671404-18.patch queued for re-testing.

neoxavier’s picture

Issue tags: +Needs tests

#18: better-api-1671404-18.patch queued for re-testing.

gdrupal’s picture

We can commit this but for now make more sense to focus our work on the 2.x branch.

dagmar’s picture

Status: Needs review » Closed (won't fix)

Let focus on 7.x-2.x.