Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I was going to run something along the lines of `drush mi my_migration || echo "FAILURE!"`... or have my CI test for the exit code to find when there were failures importing... instead... I'm getting an exit code of 0 even withs something like this:
Processed 4953 items (4270 created, 2 updated, 23 failed, 658 ignored) - done with 'upgrade_d7_taxonomy_term'
I would expect that if you have any "failed" you would have an exit code > 0... particularly when my migration is throwing error output like the following
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'name' cannot be null: INSERT INTO {taxonomy_term_field_data} [error] (tid, vid, langcode, name, description__value, description__format, weight, changed, default_langcode) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8); Array ( [:db_insert_placeholder_0] => 8426 [:db_insert_placeholder_1] => person_title [:db_insert_placeholder_2] => en [:db_insert_placeholder_3] => [:db_insert_placeholder_4] => [:db_insert_placeholder_5] => [:db_insert_placeholder_6] => 10 [:db_insert_placeholder_7] => 1463413778 [:db_insert_placeholder_8] => 1 )
Comment | File | Size | Author |
---|---|---|---|
#4 | exit-code.diff | 656 bytes | moshe weitzman |
Comments
Comment #2
moshe weitzman CreditAttribution: moshe weitzman commentedThe fix will be for this command to call drush_set_error whenever a migration fails. I think that the '23' fails in the example constitutes a failure. Its fine if the command keeps running, but logging the error will cause the right exit code to be emitted in the end.
Comment #3
mikeryanMore than minor, I think.
Comment #4
moshe weitzman CreditAttribution: moshe weitzman commentedPretty easy fix
Comment #7
moshe weitzman CreditAttribution: moshe weitzman commentedMerged into 4.x and 3.x. I'm happy to back this out if anyone objects.