Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to config-import to force installation with mismatched site UUID. #1625

Closed
markdorison opened this issue Sep 23, 2015 · 4 comments

Comments

@markdorison
Copy link

Summary

It is not possible to import a site configuration "over" a freshly installed site. This would be very useful during development and for use with automated testing when the database would not be necessary as no content is required (or desired).

Steps to Reproduce

  1. drush site-install minimal
  2. Log in and configure some pieces of the site. Set the site title, enable some modules, etc.
  3. drush site-export
  4. drush site-install minimal
  5. drush site-import

Actual Results

The site-import command in step 5 fails with the following output:

Drupal\Core\Config\ConfigImporterException: There were errors validating the config synchronization. in Drupal\Core\Config\ConfigImporter->validate() (line 730 of                    [error]
/var/www/development/chromatic.is/docroot/core/lib/Drupal/Core/Config/ConfigImporter.php).
The import failed due for the following reasons:                                                                                                                                      [error]
Site UUID in source storage does not match the target storage.

Proposed Resolution

After discussing with alexpott, I tested the following manual work-around and saw a successful import:

  1. drush site-install minimal
  2. Log in and configure some pieces of the site. Set the site title, enable some modules, etc.
  3. drush site-export
  4. Look up exported value of system.site uuid.
  5. drush site-install minimal
  6. drush cset system.site uuid [UUID-FOUND-IN-STEP-4]
  7. drush config-import

It would be fantastic if config-import would provide an option (--force?) that would include the functionality in steps 4 and 6 so that a configuration could be imported over a clean site. Is there a philosophical reason not to do this? If not, I would be interested in adding it. Is there an existing mechanism to retrieve a specific config value from the configuration exported to disk?

@weitzman
Copy link
Member

I definately see the usefulness. Perhaps alexpott could chime in here and say if this is a horrible idea or not. It would have caveats in the description and confirmation.

@markdorison
Copy link
Author

Paging @alexpott. Can you weigh in on whether this is a horrible idea?

@greg-1-anderson
Copy link
Member

A --force on config-import, when importing everything, seems safe enough to me.

You could also codify your workaround into a short script, and use cget to look up the site UUID in the source site. I think we can role this into Drush proper, although I'd still be interested to hear what @alexpott thinks.

@weitzman
Copy link
Member

Lets consolidate discussion in the PR #1635

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants