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:
Sam Doran 2018-05-17 14:07:12 -04:00 committed by GitHub
commit 59e541e31a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 30 additions and 41 deletions

View file

@ -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"

View file

@ -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'