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

DamienMcKenna created an issue. See original summary.

damienmckenna’s picture

To 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.

damienmckenna’s picture

FWIW I manually reinstalled and then fully uninstalled the Locale module on the D7 site and the error still showed.

damienmckenna’s picture

Issue summary: View changes
damienmckenna’s picture

Title: d7_language_types Migration - 1 failed » D7->D8 Language module migration runs when not appropriate

Refined the title.

huzooka’s picture

damienmckenna’s picture

Thank you for that, the problem is fixed by #3152789.

damienmckenna’s picture

Status: Closed (duplicate) » Active

I stand corrected - if the variables are migrated as NULLs, because they were optional per #3152789, the site runs into this error:

upgrade_d7_language_types Migration - 1 failed.

>drush migrate:messages upgrade_d7_language_types
 ---------------- ------------------- ------- ------------------------------ 
  Source ID(s)     Destination ID(s)   Level   Message                       
 ---------------- ------------------- ------- ------------------------------ 
  language_types                       1       The input should be an array  
 ---------------- ------------------- ------- ------------------------------ 

This is because Drupal\language\Plugin\migrate\process\LanguageTypes::transform() has this:

    if (!is_array($value)) {
      throw new MigrateException('The input should be an array');
    }
damienmckenna’s picture

Version: 8.9.x-dev » 9.1.x-dev
Status: Active » Needs review
StatusFileSize
new504 bytes

So now we end up with this, which works alongside #3152789 and makes the variables required.

damienmckenna’s picture

With #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'

mikelutz’s picture

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

Back to NW for a failing test that passes with the fix.

mikelutz’s picture

Title: D7->D8 Language module migration runs when not appropriate » [PP-1] D7->D8 Language module migration runs when not appropriate
Status: Needs work » Postponed
huzooka’s picture

Status: Postponed » Needs work

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

quietone’s picture

Title: [PP-1] D7->D8 Language module migration runs when not appropriate » D7->D8 Language module migration runs when not appropriate
Issue tags: +Novice

No longer postponed

Tagging novice for the task of changing the property name. Remember to remove the novice tag when that work is done. Thx

+++ b/core/modules/language/migrations/d7_language_types.yml
@@ -5,7 +5,7 @@ migration_tags:
+  variables_required:
...
 

s/variables_required/variables_no_row_if_missing/

anushrikumari’s picture

Assigned: Unassigned » anushrikumari
anushrikumari’s picture

Assigned: anushrikumari » Unassigned
Status: Needs work » Needs review
StatusFileSize
new1.06 KB

created patch implementing #15. Please review

anushrikumari’s picture

Issue tags: -Novice
quietone’s picture

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

anushrikumari, thanks for working on this.

  1. +++ b/core/modules/language/migrations/d7_language_negotiation_settings.yml
    @@ -5,7 +5,7 @@ migration_tags:
    +  variables_required:
    

    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'.

namitasaxena’s picture

Status: Needs work » Needs review
Issue tags: -Novice
StatusFileSize
new513 bytes
new848 bytes

Resolved points mentioned in #19.

There is 1 fail in test cases, getting this issue.

Drupal\Tests\language\Kernel\Migrate\d7\MigrateLanguageNegotiationSettingsTest::testLanguageTypes
Failed asserting that null is identical to Array &0 (
0 => 'language_content'
1 => 'language_url'
2 => 'language_interface'
).

Status: Needs review » Needs work

The last submitted patch, 20: 3155300-20.patch, failed testing. View results

quietone’s picture

Status: Needs work » Needs review
StatusFileSize
new3.39 KB

To 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

Status: Needs review » Needs work

The last submitted patch, 22: 3155300-22.patch, failed testing. View results

huzooka’s picture

quietone’s picture

Yes, your are right. Maybe this should be postponed on that.

quietone’s picture

Issue summary: View changes
Status: Needs work » Postponed
Issue tags: -Needs tests
StatusFileSize
new1.49 KB

Then the patch will be this.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

Issue tags: +migrate-d7-d8

Just updating tags,

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

The 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.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.