mirror of https://github.com/ansible/ansible.git
remove json lists as they are not valid from modules
fixes #73744
(cherry picked from commit 43300e2279
)
pull/73965/head
parent
51852557df
commit
69d18e61ed
@ -0,0 +1,2 @@
|
||||
bugfixes:
|
||||
- restrict module valid JSON parsed output to objects as lists are not valid responses.
|
@ -0,0 +1 @@
|
||||
shippable/posix/group2
|
@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eu
|
||||
|
||||
echo 'this stuff should be ignored'
|
||||
|
||||
echo '[ looks like a json list]'
|
||||
|
||||
echo '{"changed": false, "failed": false, "msg": "good json response"}'
|
||||
|
||||
echo 'moar garbage'
|
@ -0,0 +1,26 @@
|
||||
- name: ensure we clean module output well
|
||||
hosts: localhost
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: call module that spews extra stuff
|
||||
bad_json:
|
||||
register: clean_json
|
||||
ignore_errors: true
|
||||
|
||||
- name: all expected is there
|
||||
assert:
|
||||
that:
|
||||
- clean_json is success
|
||||
- clean_json is not changed
|
||||
- "clean_json['msg'] == 'good json response'"
|
||||
|
||||
- name: all non wanted is not there
|
||||
assert:
|
||||
that:
|
||||
- item not in clean_json.values()
|
||||
loop:
|
||||
- this stuff should be ignored
|
||||
- [ looks like a json list]
|
||||
- '[ looks like a json list]'
|
||||
- ' looks like a json list'
|
||||
- moar garbage
|
@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eux
|
||||
|
||||
ansible-playbook module_output_cleaning.yml "$@"
|
Loading…
Reference in New Issue