community.general/lib/ansible
Dag Wieers 56148291e9 Emit warnings when safe_eval() raises a SyntaxError or other Exception (#14304)
This change is related to reported issue #14291 and pull request #14293.

Without the fix from #14293, this change will emit a warning as shown below, on the following playbook:

``yaml
---
- hosts: localhost
  gather_facts: no
  vars:
    works:
      key1: 'string'
      key2: 1234
    fails:
      key1: 'string'
      key2: 1234
      key3: false
  tasks:
  - debug: msg={{ works | to_json }}
  - debug: msg={{ fails | to_json }}
```

On error, this results in a proper warning:

```
[dag@moria ansible.dag]$ ansible-playbook test49.yml

PLAY ***************************************************************************

TASK [debug] *******************************************************************
ok: [localhost] => {
    "msg": {
        "key1": "string",
        "key2": 1234
    }
}

TASK [debug] *******************************************************************
 [WARNING]: Error in expression "{"key3": false, "key2": 1234, "key1": "string"}". (name 'false' is not defined)

ok: [localhost] => {
    "msg": "{\"key3\": false, \"key2\": 1234, \"key1\": \"string\"}"
}

PLAY RECAP *********************************************************************
localhost                  : ok=2    changed=0    unreachable=0    failed=0
```
2016-08-12 09:29:54 -04:00
..
cli added check and diff mode control to console 2016-07-25 08:05:56 -04:00
compat Bundle a new version of python-six for compatibility along with some code to make it easy for distributions to override the bunndled copy if they have a new enough version. 2015-10-16 08:21:28 -07:00
config Making the switch to v2 2015-05-03 21:47:26 -05:00
errors Fix some typos (#16498) 2016-06-29 14:31:25 -04:00
executor Cache tasks by uuid in PlayIterator for O(1) lookups 2016-08-10 12:49:19 -05:00
galaxy Fixes #163 in galaxy-issues 2016-07-21 14:04:17 -04:00
inventory Performance improvements 2016-08-08 15:58:46 -05:00
module_utils Fix classes that select a subclass based on platform (#17034) 2016-08-11 13:26:17 -04:00
modules update submodule refs, fixes build in ansible-modules-extras 2016-08-10 13:37:10 +02:00
parsing warn when searching for an empty string or null 2016-07-26 08:26:07 -04:00
playbook Several fixes for includes 2016-08-11 14:07:49 -05:00
plugins Introduce new 'filetree' lookup plugin (#14332) 2016-08-11 23:33:54 -04:00
template Emit warnings when safe_eval() raises a SyntaxError or other Exception (#14304) 2016-08-12 09:29:54 -04:00
utils Add missing version_added (#17050) 2016-08-11 12:58:11 -04:00
vars Move tasks/blocks to a single parent model 2016-08-08 15:58:46 -05:00
__init__.py Fix ziploader for the cornercase of ansible invoking ansible. 2016-04-29 08:47:49 -07:00
constants.py * Fix race in creating temp directories pre-fork (#16965) 2016-08-04 19:35:36 -04:00
release.py Fix ziploader for the cornercase of ansible invoking ansible. 2016-04-29 08:47:49 -07:00
test-requirements.txt Making the switch to v2 2015-05-03 21:47:26 -05:00