Problem/Motivation

When attempting to run drush migrate-upgrade (provided by migrate_upgrade module), I get

The [path]/web/modules/contrib/ip2country/migrations/d7_ip2country_date_formats.yml contains invalid YAML. Non-string keys are not supported. Quote your evaluable mapping keys instead at line 11 (near "true: 'true'").

Steps to reproduce

Point drush migrate-upgrade at a Drupal 7 site where ip2country module is enabled.

Proposed resolution

Put the true and false keys in quotes: 'true': 'true' and 'false': 'false'.

Remaining tasks

Make a pull request with this change.

CommentFileSizeAuthor
#4 3185283-4-boolean.patch838 bytestr
#3 add_quotes-3185283-2.patch509 bytesbenstallings

Issue fork ip2country-3185283

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

BenStallings created an issue. See original summary.

benstallings’s picture

Assigned: Unassigned » benstallings
Status: Active » Needs review
StatusFileSize
new509 bytes

I wasn't able to get the Gitlab workflow to work for me, so here's a patch.

tr’s picture

StatusFileSize
new838 bytes

OK, but I'm curious as to why this is failing. That is NOT invalid YML and the keys should not have to be quoted - they are strings and contain no special characters that require quoting. That error message is generated by Symfony, not by migrate_upgrade or by core, so perhaps this is a change introduced in a recent version of Symfony? It seems the Symfony YAML parser is trying to determine the datatype of the key, but since keys must be strings it should instead always be interpreting those keys as strings. So a key named 1 should be valid, since it should be interpreted as the string '1' not the number 1. Likewise, key named true should be interpreted as a string 'true' not as a boolean.

Anyway, I guess we should just avoid this problem. Here's a variation of your patch where I just renamed those keys instead of quoting them - I think this makes the .yml easier to read and understand.

Can you try this to see if it fixes the problem for you?

  • TR committed 7a38d61 on 8.x-1.x
    Issue #3185283 TR, BenStallings: d7_ip2country_date_formats.yml contains...
tr’s picture

Version: 8.x-1.9 » 8.x-1.x-dev
Status: Needs review » Fixed

Committed #4.

tr’s picture

Assigned: benstallings » Unassigned

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.