Undeclared variables implementation Pull 2874

I submitted pull request a while back #2874. I’m fairly new to Ansible and Python and am looking for some community support to help contribute back these changes.

https://github.com/ansible/ansible/pull/2874

Michael DeHaan stated he was afraid of what the change might do to existing and expected behaviors. Since I set this feature conditionally and it is disabled by default, I’m not sure what the concern is. Looking for advice to correct this or gain some understanding so I can do this in a manner that is acceptable.

Michael also suggested wanting to throw these as warnings… Being fairly new to Ansible and Python., I’m not sure of the preferred way to do so. Looking for any suggestions or examples here.

He also mentioned there are two places to check for undefined “things”… I guess being newer to Ansible and Jinja2 and limited time, I’m not sure of the use-case which my change does not appear to capture. Looking for anyone to assist. I’d love to help and contribute, just need some pushes in the right direction and want to make sure it’s accommodating to the existing development and wants.

Thanks much,

Yes, I’m here. You are welcome to comment on the pull request itself too, BTW.

The template engine in Ansible runs at many points in time. If it’s run twice and the variable is only defined later in inventory scope, then it looks like the above code would raise an unnecessary error.

Thus, it seems to make sense that strict template checking is only enforced at the last possible attempt to templatize the action line or in the template module itself only.

I’ve just merged Lorin’s patch for this which was an alternative implementation.

Namely, it already did the “test at the end of the line” thing that I needed it to do.

Took a while for us to get there, but super glad to have this in as an option, regardless.

Fantastic, thanks.