Problem/Motivation
While working on #2620364: Variable to config: theme settings [d7] I discovered that the extract plugin fails when the previous plugin returns multiple true. When that happens, extract tries to extract on a scalar and an exception is thrown.
The part of the process pipeline with the problem is the conversion of the D7 theme setting name to the D8 configuration name. Seemed simple enough but it doesn't work.
process:
# build the configuration name from the variable name, i.e.
# theme_bartik_settings becomes bartik.settings
configuration_name:
-
plugin: explode
source: name
delimiter: _
-
plugin: extract
index:
- 1
-
plugin: concat
source:
-
- constants/config_suffix
This pipeline works if both extract and get use 'handle_multiples = TRUE'. Note that #2500495: Upgrade path for Color 7.x uses this same pattern.
Data model changes
Proposed resolution
Add 'handles_multiples = TRUE' to the extract annotation.
Remaining tasks
User interface changes
N/A
API changes
Comment | File | Size | Author |
---|---|---|---|
#11 | 2675156-11-test-only.patch | 2.99 KB | maijs |
#11 | 2675156-11.patch | 3.56 KB | maijs |
#10 | 2675156-10-migrate_extract_process_handle_multiple.patch | 585 bytes | mitrpaka |
#6 | 2675156-6-migrate_extract_process_handle_multiple.patch | 518 bytes | rocketeerbkw |
Comments
Comment #2
quietone CreditAttribution: quietone as a volunteer commentedCorrect title, s/destination/process.
Comment #3
quietone CreditAttribution: quietone as a volunteer commentedComment #4
quietone CreditAttribution: quietone as a volunteer commentedHopefully, a more informative title.
Comment #6
rocketeerbkw CreditAttribution: rocketeerbkw commentedI understand why extract needs to handle multiples but I don't know what it has to do with the get process plugin.
Comment #7
benjy CreditAttribution: benjy at PreviousNext commentedComment #8
chx CreditAttribution: chx at Smartsheet, Migrate Rocks commentedThe patch is correct as far as I can see but yes needs tests.
Comment #10
mitrpaka CreditAttribution: mitrpaka as a volunteer commentedTesting if needs re-roll. It seems that target file has slightly changed. Patch updated.
Comment #11
maijs CreditAttribution: maijs as a volunteer and at Wunder commentedA test that verifies multiple value handling has been added. The patch with a test only should fail.
Comment #13
maijs CreditAttribution: maijs as a volunteer and at Wunder commentedTest-only patch failed, but the other patch in #11 needs review.
Comment #14
iMiksuTests is looking good for me. Also together with the fix :)
Comment #15
iMiksuComment #16
mikeryanLooks good, thanks!
Comment #17
alexpottCommitted and pushed 0aed30b to 8.3.x and 8dd44b1 to 8.2.x. Thanks!
Comment #21
quietone CreditAttribution: quietone as a volunteer commentedAlways nice to see more testing.
However, the process pipeline in the test uses extract followed by extract, when the issue is about explode followed by an extract. And it seems the original problem is not fixed because #2827656: Once a process plugin returns multiple values, all following plugins are expected to handle multiple values was opened.
Comment #22
maijs CreditAttribution: maijs as a volunteer and at Wunder commentedI agree that the test does not cover the whole explode-then-extract process, but the issue and the fix certainly does cover the immediate problem with the extract process plugin where it wasn't even able to catch multiple values at all. I propose to limit the scope of this issue only to process plugin while dealing with a more systematic problem with multi-value handling in #2827656.