mirror of https://github.com/ansible/ansible.git
also added tests for normal and bad cases
(cherry picked from commit 281474e809
)
pull/80019/head
parent
02d9336b32
commit
58d66a7568
@ -0,0 +1,2 @@
|
||||
bugfixes:
|
||||
- strategy plugins now correctly identify bad registered variables, even on skip.
|
@ -0,0 +1,2 @@
|
||||
shippable/posix/group3
|
||||
context/controller # this "module" is actually an action that runs on the controller
|
@ -0,0 +1,21 @@
|
||||
- hosts: testhost
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: test registering
|
||||
debug: msg='does nothing really but register this'
|
||||
register: debug_msg
|
||||
|
||||
- name: validate registering
|
||||
assert:
|
||||
that:
|
||||
- debug_msg is defined
|
||||
|
||||
- name: test registering skipped
|
||||
debug: msg='does nothing really but register this'
|
||||
when: false
|
||||
register: debug_skipped
|
||||
|
||||
- name: validate registering
|
||||
assert:
|
||||
that:
|
||||
- debug_skipped is defined
|
@ -0,0 +1,11 @@
|
||||
- hosts: testhost
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: test registering
|
||||
debug: msg='does nothing really but register this'
|
||||
register: 200
|
||||
|
||||
- name: never gets here
|
||||
assert:
|
||||
that:
|
||||
- 200 is not defined
|
@ -0,0 +1,12 @@
|
||||
- hosts: testhost
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: test registering bad var when skipped
|
||||
debug: msg='does nothing really but register this'
|
||||
when: false
|
||||
register: 200
|
||||
|
||||
- name: never gets here
|
||||
assert:
|
||||
that:
|
||||
- 200 is not defined
|
@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eux
|
||||
|
||||
# does it work?
|
||||
ansible-playbook can_register.yml -i ../../inventory -v "$@"
|
||||
|
||||
# ensure we do error when it its apprpos
|
||||
set +e
|
||||
result="$(ansible-playbook invalid.yml -i ../../inventory -v "$@" 2>&1)"
|
||||
set -e
|
||||
grep -q "Invalid variable name in " <<< "${result}"
|
Loading…
Reference in New Issue