Postponed on #3176393: Use SourcePluginBase::getSourceModule() in DrupalSqlBase::checkRequirements()
Working on a migration of a D7 site to D 8.9.x using Migrate Upgrade.
When the migration runs (via Migrate Upgrade) the following error is left:
d7_language_types Migration - 1 failed
No other messages are left.
I checked the D7 site and none of the Locale module's variables were present, so I'm not sure why this migration would have been queued?
Full output:
[notice] Processed 1 item (0 created, 0 updated, 1 failed, 0 ignored) - done with 'd7_language_types' [9.88 sec, 238.9 MB]
In MigrateToolsCommands.php line 870:
[Exception]
d7_language_types Migration - 1 failed.
Exception trace:
at /var/www/html/web/modules/contrib/migrate_tools/src/Commands/MigrateToolsCommands.php:870
Drupal\migrate_tools\Commands\MigrateToolsCommands->executeMigration() at n/a:n/a
array_walk() at /var/www/html/web/modules/contrib/migrate_tools/src/Commands/MigrateToolsCommands.php:324
Drupal\migrate_tools\Commands\MigrateToolsCommands->import() at n/a:n/a
call_user_func_array() at /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php:257
Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback() at /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php:212
Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter() at /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php:176
Consolidation\AnnotatedCommand\CommandProcessor->process() at /var/www/html/vendor/consolidation/annotated-command/src/AnnotatedCommand.php:302
Consolidation\AnnotatedCommand\AnnotatedCommand->execute() at /var/www/html/vendor/symfony/console/Command/Command.php:255
Symfony\Component\Console\Command\Command->run() at /var/www/html/vendor/symfony/console/Application.php:1005
Symfony\Component\Console\Application->doRunCommand() at /var/www/html/vendor/symfony/console/Application.php:255
Symfony\Component\Console\Application->doRun() at /var/www/html/vendor/symfony/console/Application.php:148
Symfony\Component\Console\Application->run() at /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php:118
Drush\Runtime\Runtime->doRun() at /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php:49
Drush\Runtime\Runtime->run() at /var/www/html/vendor/drush/drush/drush.php:72
require() at /var/www/html/vendor/drush/drush/includes/preflight.inc:18
drush_main() at phar:///usr/local/bin/drush/bin/drush.php:141
require() at /usr/local/bin/drush:10
Comments
Comment #2
damienmckennaTo be clear: the D7 site did not have the Locale module installed (currently, anyway, and none of the variables are present), but the D8 site did the install Language.
Comment #3
damienmckennaFWIW I manually reinstalled and then fully uninstalled the Locale module on the D7 site and the error still showed.
Comment #4
damienmckennaComment #5
damienmckennaRefined the title.
Comment #6
huzookaSee #3151980-6: System mail settings migration (d7_system_mail) assumes that the mail_system variable is always available.
This also can be solved by the help of improving the Variable source plugin #3152789: Add required variables config to Variable migrate source plugin, and if one of those are missing, return zero rows. @DamienMcKenna, if you can help it moving forward, that would be awesome.
Comment #7
damienmckennaThank you for that, the problem is fixed by #3152789.
Comment #8
damienmckennaI stand corrected - if the variables are migrated as NULLs, because they were optional per #3152789, the site runs into this error:
This is because Drupal\language\Plugin\migrate\process\LanguageTypes::transform() has this:
Comment #9
damienmckennaSo now we end up with this, which works alongside #3152789 and makes the variables required.
Comment #10
damienmckennaWith #9 applied to a codebase it results in the following:
[notice] Processed 0 items (0 created, 0 updated, 0 failed, 0 ignored) - done with 'upgrade_d7_language_types'Comment #11
mikelutzBack to NW for a failing test that passes with the fix.
Comment #12
mikelutzActually this is postponed on #3152789: Add required variables config to Variable migrate source plugin, and if one of those are missing, return zero rows
Comment #13
huzookaComment #15
quietone commentedNo longer postponed
Tagging novice for the task of changing the property name. Remember to remove the novice tag when that work is done. Thx
s/variables_required/variables_no_row_if_missing/
Comment #16
anushrikumari commentedComment #17
anushrikumari commentedcreated patch implementing #15. Please review
Comment #18
anushrikumari commentedComment #19
quietone commentedanushrikumari, thanks for working on this.
I don't see anything in the issue that says that this file needs to be change. I think this should be removed.
Still needs work for #15, which is to change to the string 'variables_required' to 'variables_no_row_if_missing'.
Comment #20
namitasaxena commentedResolved points mentioned in #19.
There is 1 fail in test cases, getting this issue.
Comment #22
quietone commentedTo answer the question about why the migration is running. The migration d7_language_types runs because language is enabled on the destination and the migration is discovered.
Ah, the suggested approach won't work since we will not get any of the variables if only one is missing. Instead, it should get all the available variables but only if locale is enabled on the source.
The migration does declare locale as the source_module and that is supposed to be used by checkRequirements which will throw an error if the module is not enabled on the source. However, it is not. DrupalSqlBase::checkRequirements uses the source_module from the source plugin annotation. For the variable source plugin it makes sense that the migration can override the source_module declaration.
This patch does that and adds a test that checks the requirements. There is no interdiff because this is a new approach.
Edit: grammar fixes
Comment #24
huzooka#22 reminds me of #3176393: Use SourcePluginBase::getSourceModule() in DrupalSqlBase::checkRequirements().
Comment #25
quietone commentedYes, your are right. Maybe this should be postponed on that.
Comment #26
quietone commentedThen the patch will be this.
Comment #30
quietone commentedJust updating tags,
Comment #33
quietone commentedThe Migrate Drupal Module was approved for removal in #3371229: [Policy] Migrate Drupal and Migrate Drupal UI after Drupal 7 EOL.
This is Postponed. The status is set according to two policies. The Remove a core extension and move it to a contributed project and the Extensions approved for removal policies.
The deprecation work is in #3522602: [meta] Tasks to remove Migrate Drupal module and the removal work in #3522602: [meta] Tasks to remove Migrate Drupal module.
Migrate Drupal will not be moved to a contributed project. It will be removed from core after the Drupal 12.x branch is open.