You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible/docs/docsite/rst
Daniel Goldman 989eeb243f
Add an `undef` global Jinja function (#75435)
* add tests for fail filter

also tests that fail does not block inspectability

* add fail filter

fallback message is a bit clunky,
since you can't invoke a filter without specifying an input.
That is, "{{ fail }}" doesn't work,
so you have to do "{{ None | fail }}"

* document 'fail' filter

* add changelog fragment

* fail filter uses default message on Undefined or emptystring

makes it slightly easier to use the default message:
```diff
- "{{ None | fail }}"
+ "{{ '' | fail }}"
```

and the user sees a slightly more relevant message
if the message itself is undefined:

```diff
- The error was: {{ failmsg | fail }}: 'failmsg' is undefined
+ The error was: {{ failmsg | fail }}: Mandatory variable has not been overridden
```

* rebuild as the builtin `Undefined`

* harmonise `hint` parameter for make_undefined with jinja

* use code block for documentation item

[ref](https://github.com/ansible/ansible/pull/75435#discussion_r707661035)

* rename to `undef` to expose less Python into the Jinja

[ref](https://github.com/ansible/ansible/pull/75435#pullrequestreview-757799031)

* explicitly instantiate undefined value now that it's possible

see I knew we would break something with reflection

* preserve test coverage of undefined variable

Co-authored-by: Matt Davis <nitzmahone@users.noreply.github.com>
3 years ago
..
api remove build errors including guess (#69711) 4 years ago
collections Add link to all module and plugin indexes (#72743) 4 years ago
community Docs: Add more Matrix documentation (#75588) 3 years ago
dev_guide Docs: Fix section header notation in Style Guide (#75720) 3 years ago
galaxy Docs: Add Matrix as a chat option (#75406) 3 years ago
images Adds custom 404 with cowsay image (#57422) 5 years ago
installation_guide updated 'Installing Ansible on Debian' details (#75567) 3 years ago
inventory Add implicit localhost hostvars note (#61956) 5 years ago
locales/ja/LC_MESSAGES Misc typo fixes (#75188) 3 years ago
network Fix various typos in documentation (#75662) 3 years ago
plugins Docs: clarify dir names for local plugins (#75157) 3 years ago
porting_guides Remove (only) user-facing use of ANSIBLE_ASYNC_DIR (#74249) 3 years ago
reference_appendices Fix various typos in documentation (#75662) 3 years ago
roadmap Slip ansible 5 release [alternative] (#75529) 3 years ago
scenario_guides Fix various typos in documentation (#75662) 3 years ago
shared_snippets Enable ansible-galaxy to specify client id override with Keycloak Token (#75601) 3 years ago
user_guide Add an `undef` global Jinja function (#75435) 3 years ago
2.10_index.rst Split Ansible docs from core docs (#73616) 4 years ago
404.rst removes link from 404 content, explains options (#57971) 5 years ago
ansible_index.rst Split Ansible docs from core docs (#73616) 4 years ago
core_index.rst Add 2.12 roadmap (#74000) 4 years ago