1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/test/sanity/code-smell
James Cammarata a2599cab79 Fix variable precedence of INI/script vars to be in-line with docs.
This commit also adds a new test script (ansible-var-precedence-check.py in code-smell/)
to provide us with another line of defense against precedence bugs going forward.

The precedence docs state that the INI vars have a lower precedence than group/host
vars files for inventory and playbooks, however that has not been the case since 2.0
was released. This change fixes that in one way, though not exactly as the docs say.
The rules are:

1) INI/script < inventory dir < playbook dir
2) "all" group vars < other group_vars < host_vars

So the new order will be (from the test script mentioned above):

8. pb_host_vars_file - var in playbook/host_vars/host
9. ini_host_vars_file - var in inventory/host_vars/host
10. ini_host - host var inside the ini
11. pb_group_vars_file_child - var in playbook/group_vars/child
12. ini_group_vars_file_child - var in inventory/group_vars/child
13. pb_group_vars_file_parent - var in playbook/group_vars/parent
14. ini_group_vars_file_parent - var in inventory/group_vars/parent
15. pb_group_vars_file_all - var in playbook/group_vars/all
16. ini_group_vars_file_all - var in inventory/group_vars/all
17. ini_child - child group var inside the ini
18. ini_parent - parent group var inside the ini
19. ini_all - all group var inside the ini

Fixes #21845
2017-03-02 17:07:00 -06:00
..
ansible-var-precedence-check.py Fix variable precedence of INI/script vars to be in-line with docs. 2017-03-02 17:07:00 -06:00
boilerplate.sh Move ssh and local connection plugins from using raw select to selectors 2017-02-03 08:23:50 -08:00
configure-remoting-ps1.sh Add test for ConfigureRemotingForAnsible.ps1. 2017-01-06 10:40:13 -08:00
empty-init.sh Add empty-init code-smell script. (#18406) 2016-11-07 15:02:13 -08:00
inappropriately-private.sh Cleanup and fixes for code smell scripts. 2016-11-03 23:56:30 -07:00
integration-aliases.py Test placement (#21801) 2017-02-22 12:43:45 -08:00
line-endings.sh Clean up code-smell sanity scripts. (#18407) 2016-11-07 16:46:33 -08:00
no-basestring.sh Fix tests after repo merge. 2016-12-08 11:35:19 -05:00
no-dict-iteritems.sh Code smell test for iteritems and itervalues (#19292) 2016-12-14 12:16:16 -08:00
no-dict-itervalues.sh Code smell test for iteritems and itervalues (#19292) 2016-12-14 12:16:16 -08:00
no-iterkeys.sh Overhaul ansible-test sanity implementation. (#22177) 2017-03-02 12:36:46 -08:00
pylint-ansible-test.sh Consider module_utils deps when running tests. (#21382) 2017-02-13 18:49:36 -08:00
replace-urlopen.sh Clean up code-smell sanity scripts. (#18407) 2016-11-07 16:46:33 -08:00
required-and-default-attributes.sh Test reorganization and cleanup. (#18270) 2016-10-31 12:53:11 -07:00
shebang.sh Combine jimi-c and bcoca's ideas and work on hooking module-utils into PluginLoader. 2017-01-31 09:41:24 -08:00
skip.txt Initial ansible-test implementation. (#18556) 2016-11-29 21:21:53 -08:00
test-constraints.sh Correct test constraints and add sanity check. 2017-01-08 16:44:31 -08:00
use-compat-six.sh Fix tests after repo merge. 2016-12-08 11:35:19 -05:00