mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-22 20:13:59 -07:00
Change behavior to behaviour in docs and tests (#39392)
* Change behavior to behaviour - use existing fact to get hash setting rather than shell task - fix code highlighting syntax in playbooks_variables.rst * Re-wrote intro section; this entire topic needs a clean-up/rewrite.
This commit is contained in:
parent
c9d3bb59a4
commit
59e541e31a
6 changed files with 30 additions and 41 deletions
|
@ -1,4 +1,4 @@
|
|||
# test code for the hash variable behavior
|
||||
# test code for the hash variable behaviour
|
||||
# (c) 2014, James Cammarata <jcammarata@ansible.com>
|
||||
|
||||
# This file is part of Ansible
|
||||
|
@ -16,26 +16,22 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
- name: get the hash behavior env setting
|
||||
shell: env | grep ^ANSIBLE_HASH_BEHAVIOUR'=' | cut -f2- -d'='
|
||||
register: hash_behavior
|
||||
# This only works with the local connection. The way this test is run means the
|
||||
connection: local
|
||||
delegate_to: localhost
|
||||
- name: debug hash behaviour result
|
||||
debug:
|
||||
var: ansible_env.ANSIBLE_HASH_BEHAVIOUR
|
||||
verbosity: 2
|
||||
|
||||
|
||||
- name: debug hash behavior result
|
||||
debug: var=hash_behavior.stdout
|
||||
|
||||
- name: assert hash behavior is merge or replace
|
||||
- name: assert hash behaviour is merge or replace
|
||||
assert:
|
||||
that:
|
||||
- "hash_behavior.stdout in ('merge', 'replace')"
|
||||
- ansible_env.ANSIBLE_HASH_BEHAVIOUR in ('merge', 'replace')
|
||||
|
||||
- name: debug test_hash var
|
||||
debug: var=test_hash
|
||||
debug:
|
||||
var: test_hash
|
||||
verbosity: 2
|
||||
|
||||
- name: assert the dictionary values match
|
||||
assert:
|
||||
that:
|
||||
- "hash_behavior.stdout == 'merge' and test_hash == merged_hash or hash_behavior.stdout == 'replace' and test_hash == replaced_hash"
|
||||
- "ansible_env.ANSIBLE_HASH_BEHAVIOUR == 'merge' and test_hash == merged_hash or ansible_env.ANSIBLE_HASH_BEHAVIOUR == 'replace' and test_hash == replaced_hash"
|
|
@ -1,4 +1,3 @@
|
|||
---
|
||||
- hosts: testhost
|
||||
vars_files:
|
||||
- vars/test_hash_vars.yml
|
||||
|
@ -17,4 +16,6 @@
|
|||
role_vars: "this is in role vars/main.yml"
|
||||
vars_file: "this is in a vars_file"
|
||||
roles:
|
||||
- { role: test_hash_behavior, test_hash: {'role_argument':'this is a role argument variable'} }
|
||||
- role: test_hash_behaviour
|
||||
test_hash:
|
||||
role_argument: 'this is a role argument variable'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue