File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
docs/docsite/rst/porting_guides Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -782,6 +782,32 @@ Noteworthy plugin changes
782
782
This filter now returns ``False `` instead of ``None `` when the input is ``None ``.
783
783
The aforementioned deprecation warning is also issued in this case.
784
784
785
+ * Passing nested non-scalars with embedded templates that may resolve to ``Undefined `` to Jinja2
786
+ filter plugins, such as ``default `` and ``mandatory ``, and test plugins including ``defined `` and ``undefined ``
787
+ no longer evaluate as they did in previous versions because nested non-scalars with embedded templates are templated
788
+ on use only.
789
+ In 2.19, this assertion passes:
790
+
791
+ .. code-block :: yaml
792
+
793
+ - assert :
794
+ that :
795
+ # Unlike earlier versions, complex_var is defined even though complex_var.nested is not.
796
+ - complex_var is defined
797
+ # Unlike earlier versions, the default value is not applied because complex_var is defined.
798
+ - (complex_var | default(unused)).nested is undefined
799
+ # Like earlier versions, directly accessing complex_var.nested evaluates as undefined.
800
+ - complex_var.nested is undefined
801
+ vars :
802
+ complex_var :
803
+ # Before 2.19, complex_var.nested is evaluated immediately when complex_var is accessed.
804
+ # In 2.19, complex_var.nested is evaluated only when it is accessed.
805
+ nested : " {{ undefined_variable }}"
806
+ unused :
807
+ # This variable is used only if complex_var is undefined.
808
+ # This only happens in ansible-core before 2.19.
809
+ nested : default
810
+
785
811
786
812
Porting custom scripts
787
813
======================
You can’t perform that action at this time.
0 commit comments