Commit bbe4f89
committed
fix(cfn-lang-ext): route Fn::ForEach dynamic-property consumers through jmespath
PACKAGEABLE_RESOURCE_ARTIFACT_PROPERTIES now contains dotted paths like
Command.ScriptLocation (Glue) and Code.ImageUri (Lambda image), but four
call sites in build_context, sam_integration, and language_extensions_packaging
were still doing flat-key dict access:
- _update_foreach_artifact_paths
- _count_dynamic_properties
- _get_artifact_value
- detect_foreach_dynamic_properties
For dotted entries those reads return None, the early skip kicks in, no
SAM* mapping is generated, and the dotted artifact value never propagates
back to the Fn::ForEach body. CloudFormation Mapping names and FindInMap
third-arg keys also can't contain dots.
Switch the four sites to _get_prop_value / _set_prop_value, derive the
Mapping name and FindInMap third-arg from the leaf segment via a new
_leaf_prop_name helper, and add _resolve_property_paths to skip parent
paths when a more specific dotted child is present (so Lambda::Function
"Code" doesn't shadow "Code.ImageUri" for image functions).
Adds 6 regression tests covering Fn::ForEach over Glue::Job with
templated Command.ScriptLocation and Lambda::Function with templated
Code.ImageUri at both detection and Mapping-generation layers.
Addresses review feedback on PR #9009.1 parent d96d5bb commit bbe4f89
5 files changed
Lines changed: 358 additions & 27 deletions
File tree
- samcli
- commands/build
- lib
- cfn_language_extensions
- package
- tests/unit/commands
- buildcmd
- package
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
553 | 553 | | |
554 | 554 | | |
555 | 555 | | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
556 | 562 | | |
557 | 563 | | |
558 | 564 | | |
| |||
599 | 605 | | |
600 | 606 | | |
601 | 607 | | |
602 | | - | |
603 | | - | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
604 | 611 | | |
605 | 612 | | |
606 | 613 | | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
607 | 619 | | |
608 | 620 | | |
609 | 621 | | |
| |||
622 | 634 | | |
623 | 635 | | |
624 | 636 | | |
625 | | - | |
| 637 | + | |
626 | 638 | | |
627 | 639 | | |
628 | 640 | | |
| |||
637 | 649 | | |
638 | 650 | | |
639 | 651 | | |
640 | | - | |
| 652 | + | |
641 | 653 | | |
642 | 654 | | |
643 | 655 | | |
| |||
648 | 660 | | |
649 | 661 | | |
650 | 662 | | |
651 | | - | |
| 663 | + | |
652 | 664 | | |
653 | 665 | | |
654 | 666 | | |
| |||
707 | 719 | | |
708 | 720 | | |
709 | 721 | | |
| 722 | + | |
710 | 723 | | |
711 | 724 | | |
712 | 725 | | |
| |||
718 | 731 | | |
719 | 732 | | |
720 | 733 | | |
721 | | - | |
722 | | - | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
723 | 737 | | |
724 | 738 | | |
725 | 739 | | |
| |||
759 | 773 | | |
760 | 774 | | |
761 | 775 | | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
762 | 780 | | |
| 781 | + | |
| 782 | + | |
763 | 783 | | |
| 784 | + | |
764 | 785 | | |
765 | 786 | | |
766 | 787 | | |
| |||
778 | 799 | | |
779 | 800 | | |
780 | 801 | | |
781 | | - | |
| 802 | + | |
782 | 803 | | |
783 | 804 | | |
784 | 805 | | |
| |||
793 | 814 | | |
794 | 815 | | |
795 | 816 | | |
796 | | - | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
797 | 821 | | |
798 | 822 | | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
799 | 826 | | |
800 | 827 | | |
801 | 828 | | |
| |||
821 | 848 | | |
822 | 849 | | |
823 | 850 | | |
824 | | - | |
| 851 | + | |
825 | 852 | | |
826 | 853 | | |
827 | 854 | | |
| |||
895 | 922 | | |
896 | 923 | | |
897 | 924 | | |
898 | | - | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
899 | 931 | | |
900 | 932 | | |
901 | 933 | | |
902 | 934 | | |
903 | 935 | | |
904 | 936 | | |
905 | | - | |
| 937 | + | |
906 | 938 | | |
907 | 939 | | |
908 | 940 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
412 | 412 | | |
413 | 413 | | |
414 | 414 | | |
415 | | - | |
416 | | - | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
417 | 419 | | |
418 | 420 | | |
419 | 421 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
137 | 181 | | |
138 | 182 | | |
139 | 183 | | |
| |||
330 | 374 | | |
331 | 375 | | |
332 | 376 | | |
333 | | - | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
334 | 380 | | |
335 | 381 | | |
336 | 382 | | |
| |||
363 | 409 | | |
364 | 410 | | |
365 | 411 | | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
366 | 416 | | |
367 | 417 | | |
368 | 418 | | |
| |||
394 | 444 | | |
395 | 445 | | |
396 | 446 | | |
397 | | - | |
| 447 | + | |
398 | 448 | | |
399 | 449 | | |
400 | 450 | | |
| |||
421 | 471 | | |
422 | 472 | | |
423 | 473 | | |
424 | | - | |
| 474 | + | |
425 | 475 | | |
426 | 476 | | |
427 | 477 | | |
| |||
465 | 515 | | |
466 | 516 | | |
467 | 517 | | |
468 | | - | |
| 518 | + | |
| 519 | + | |
469 | 520 | | |
470 | 521 | | |
471 | 522 | | |
| |||
478 | 529 | | |
479 | 530 | | |
480 | 531 | | |
481 | | - | |
| 532 | + | |
482 | 533 | | |
483 | 534 | | |
484 | 535 | | |
| |||
531 | 582 | | |
532 | 583 | | |
533 | 584 | | |
534 | | - | |
| 585 | + | |
| 586 | + | |
535 | 587 | | |
536 | 588 | | |
537 | 589 | | |
| |||
581 | 633 | | |
582 | 634 | | |
583 | 635 | | |
584 | | - | |
585 | | - | |
586 | | - | |
587 | | - | |
588 | | - | |
589 | | - | |
590 | | - | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
591 | 650 | | |
592 | 651 | | |
593 | 652 | | |
| |||
0 commit comments