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

Migrations requirements are not visible in Drush logs #5051

Open
db-Matroskeen opened this issue Jan 29, 2022 · 0 comments · May be fixed by #5052
Open

Migrations requirements are not visible in Drush logs #5051

db-Matroskeen opened this issue Jan 29, 2022 · 0 comments · May be fixed by #5052

Comments

@db-Matroskeen
Copy link

db-Matroskeen commented Jan 29, 2022

Describe the bug
If migration requirements are not met, then the following message is visible in Drush logs:
[debug] Migration 'foo' is skipped as its source plugin has missed requirements: . [0.13 sec, 24.65 MB]

Requirements details are missing. Let's look at this code to understand why:

foreach ($migrations as $migrationId => $migration) {
    try {
        $sourcePlugin = $migration->getSourcePlugin();
        if ($sourcePlugin instanceof RequirementsInterface) {
            $sourcePlugin->checkRequirements();
        }
    } catch (RequirementsException $exception) {
        $this->logger()->debug("Migration '{$migrationId}' is skipped as its source plugin has missed requirements: " . $exception->getRequirementsString());
        unset($migrations[$migrationId]);
    }
}

The problem is at $exception->getRequirementsString(), which returns an information about requirements array passed into the exception. This array is supposed to provide additional metadata and probably shouldn't be visible for developers. At least, I don't see any value in this information. That's why I opened a drupal.org issue to adjust the message format as well: https://www.drupal.org/project/drupal/issues/3254986. Feel free to check it out to see more details.

Speaking of Drush commands, if requirements were passed as 2nd argument, the message is the following:
Migration 'd6_comment' is skipped as its source plugin has missed requirements: source_module: comment.

Otherwise, the message is:
Migration 'user_profile_field_instance' is skipped as its source plugin has missed requirements: .

To Reproduce

  1. Install latest Drupal core (9.4.x);
  2. Install Migrate Drupal module;
  3. Run drush ms user_profile_field_instance -vvv

Expected behavior
I would expect the following message (with or without the requirements array):
Migration 'd6_comment' is skipped as its source plugin has missed requirements: The module comment is not enabled in the source site.

Actual behavior
Migration 'd6_comment' is skipped as its source plugin has missed requirements: source_module: comment.

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