I have installed robotstxt module in my dev. It failed and then I was required to uninstall. After I uninstalled the module without any errors via GUI I'm trying to re-install the latest DEV of robotstxt and always get this error:
Unable to install robots.txt, migrate.migration.d6_robotstxt_settings, migrate.migration.d7_robotstxt_settings already exist in active configuration.
It looks like Core is seriously broken what makes this critical for release as I'm unable to install a module.
Comments
Comment #1
hass commentedComment #2
hass commentedComment #3
dawehnerMaybe adding:
helps.
See http://cgit.drupalcode.org/robotstxt/tree/config/install/migrate.migrati... is missing that.
Comment #4
larowlanWaiting on suggestion from dawhner
Comment #5
mikeryanI believe core is supposed to automatically delete configuration when a module is uninstalled, but it doesn't seem to be happening (I see the issue with migrate_drupal, as well as my own migrate_plus sandbox).
Comment #6
mikeryanIt appears that only configuration entities keyed by the module itself are deleted, not entities the module instantiates from entity types defined by another module. E.g., if robotstxt defined its own configuration entity type "robot" and had a robotstxt.robot.default.yml file in schema/install, robotstxt.robot.default would be deleted, but as seen above migrate.migration.d6_robotstxt_settings is not. I'm looking now at ConfigManager::findConfigEntityDependentsAsEntities().
As far as I can tell, this is a general issue that any module which installs configuration entities based on another module's config entity type cannot be reinstalled after being installed. Looks critical to me.
For reference, my IRC chat with @chx:
chx: mikeryan1: if i needed to make a guess
[3:16pm] chx: mikeryan1: it only deletes the config where the first part is the module being uninstalled
[3:16pm] chx: mikeryan1: so ... if your module installs a view, it's very hard to figure out your module did it
[3:16pm] mikeryan1: I got far enough to see that in ConfigManager::uninstall(), getConfigEntitiesToChangeOnDependencyRemoval() isn’t returning anything to delete
[3:17pm] mikeryan1: First part of the config key?
[3:19pm] chx: this is interesting
[3:19pm] chx: ah
[3:20pm] chx: foreach ($this->activeStorage->getAllCollectionNames() as $collection) {
[3:20pm] chx: $collection_storage = $this->activeStorage->createCollection($collection);
[3:20pm] chx: $collection_storage->deleteAll($name . '.');
[3:20pm] chx: mikeryan1: ^ this is what i meant
[3:20pm] chx: mikeryan1: if you uninstall module foo then it uninstalls foo.*
[3:20pm] chx: mikeryan1: but i am wrong -- apparetly it tries to remove entities as well. that part i do not understand.
[3:22pm] mikeryan1: Fails in UI too
[3:24pm] mikeryan1: I think we’re looking at a critical here
[3:28pm] mikeryan1: Right, before it gets to that point it’s trying to delete dependent config entities, but getConfigEntitiesToChangeOnDependencyRemoval() isn’t returning any
[3:28pm]
Comment #7
mikeryanOK, @xjm has helped clarify things - @dawehner had the right idea above, I wasn't aware that one needed to declare a dependency on your own module for configuration to be deleted on uninstall. It's up to robotstxt to fix this.
This has been illuminating - migrate_drupal in core needs to also deal with this.
Comment #8
hass commentedThanks for looking into this.
I'm asking me how the dependency solves the uninstall issue here. It sounds a bit like suppressing the error with a not fullfilled dependency only. The issue itself is still not solved as there is migration code not uninstalled, isn't it?
I'm also a bit confused how or why this stuff has been installed as I have not run any migration.
Migrate and Migrate Drupal modules are disabled for sure.
Comment #9
mikeryanThe migrations are defined in config/install, thus are installed when the module is installed. The idea of the dependency is that when the module is uninstalled, any configuration entities with a dependency on the module will be removed.
Comment #10
hass commentedBut this migration installation does not migrate the settings? I still try to understand migration code... There is also no module in core that has a dependency added in migration files.
Is #2459729: No schema for migrate.migration.* also caused by the missing dependency or an independend issue?
Comment #12
hass commentedGA http://drupalcode.org/project/google_analytics.git/commit/88b5c55
Comment #13
hass commentedThe recommendation #3 from dawehner does not work. You can try it yourself with Google Analytics module.
Unable to install Google Analytics, migrate.migration.d6_google_analytics_settings, migrate.migration.d7_google_analytics_settings already exist in active configuration.Moving back to core.
Comment #14
xjmThe problem with http://cgit.drupalcode.org/google_analytics/commit/?id=88b5c55 is it needs to use an enforced dependency instead.
Comment #15
xjmRelevant change record: https://www.drupal.org/node/2404447
Comment #16
hass commentedThis does NOT work either.
Comment #17
xjm@hass, I tried it and it seems to work fine? You might want to start fresh with your D8 parent site to get rid of the stale config, or try uninstalling migrate to clean up the stale config, which also should delete it without the need for a dependency key.
Comment #18
xjmFiled: #2460529: Migrations need to use the configuration entity dependency system
Comment #19
hass commentedI deleted the database and started from scratch all times.
I have never installed migrate module.
It doesn't work.
Comment #20
alexpottThis is a bug in the Migration module - considering it choose to use config entities to store migrations in ConfigEntities then is has to use the Config entity dependency system properly. If a migration is for migration a piece of configuration for a module then it should have a dependency on that module. Basically we need to implement a calculateDependencies method. Or make migrations not configuration entities.
Wrt to the Robot.txt module it should move the migration into config/optional because it is should only be created when the migrate module is installed - that will the fix the install and reinstall error.
Comment #21
hass commented@alexpott: So i move to
optionalfolder and rollback dependencies declaration in the migration files?Comment #22
mikeryan@hass: There are already core issues around the general problem with migrate configuration entities (#2460301: Migration config entities don't store dependencies, #2460301: Migration config entities don't store dependencies, #2459619: migrate_drupal cannot be uninstalled and reinstalled - this issue here is about what the RobotsTxt module needs to do once those issues are addressed.
Comment #23
alexpott@hass yep just move your migration config entity to config/optional - adding dependencies to it won't really work until #2460301: Migration config entities don't store dependencies is addressed
Comment #24
hass commentedThese others are all brand new issues opened because of this issue here and the issue here is not a bug in robotstxt module.
Not sure why you move the case here. It is a core issue, not a module issue and I can track the changes with the core issues.