Skip to content

Commit 1ed932e

Browse files
committed
tests: Eliminate MITOGEN_INVENTORY_FILE
Replaced with ansible_inventory_sources.
1 parent 900760e commit 1ed932e

File tree

6 files changed

+57
-22
lines changed

6 files changed

+57
-22
lines changed

tests/ansible/integration/process/unix_socket_cleanup.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@
1010
- shell: >
1111
ANSIBLE_STRATEGY=mitogen_linear
1212
ANSIBLE_SSH_ARGS=""
13-
ansible -m shell -c local -a whoami -i "{{MITOGEN_INVENTORY_FILE}}" test-targets
13+
ansible -m shell -c local -a whoami
14+
{% for inv in ansible_inventory_sources %}
15+
-i "{{ inv }}"
16+
{% endfor %}
17+
test-targets
1418
args:
1519
chdir: ../..
1620
register: out

tests/ansible/integration/runner/missing_module.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
connection: local
88
command: |
99
ansible -vvv
10-
-i "{{MITOGEN_INVENTORY_FILE}}"
10+
{% for inv in ansible_inventory_sources %}
11+
-i "{{ inv }}"
12+
{% endfor %}
1113
test-targets
1214
-m missing_module
1315
args:

tests/ansible/integration/ssh/timeouts.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
ANSIBLE_SSH_TIMEOUT: 10
1010
command: |
1111
ansible -vvv
12-
-i "{{MITOGEN_INVENTORY_FILE}}"
12+
{% for inv in ansible_inventory_sources %}
13+
-i "{{ inv }}"
14+
{% endfor %}
1315
test-targets
1416
-m custom_python_detect_environment
1517
-e ansible_user=mitogen__slow_user -e ansible_password=slow_user_password

tests/ansible/integration/ssh/variables.yml

Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@
1818
ANSIBLE_ANY_ERRORS_FATAL=false
1919
ANSIBLE_STRATEGY=mitogen_linear
2020
ANSIBLE_SSH_ARGS=""
21-
ansible -m shell -a whoami -i "{{MITOGEN_INVENTORY_FILE}}" test-targets
21+
ansible -m shell -a whoami
22+
{% for inv in ansible_inventory_sources %}
23+
-i "{{ inv }}"
24+
{% endfor %}
25+
test-targets
2226
-e ansible_ssh_user=mitogen__has_sudo
2327
-e ansible_ssh_pass=has_sudo_password
2428
args:
@@ -31,7 +35,11 @@
3135
ANSIBLE_ANY_ERRORS_FATAL=false
3236
ANSIBLE_STRATEGY=mitogen_linear
3337
ANSIBLE_SSH_ARGS=""
34-
ansible -m shell -a whoami -i "{{MITOGEN_INVENTORY_FILE}}" test-targets
38+
ansible -m shell -a whoami
39+
{% for inv in ansible_inventory_sources %}
40+
-i "{{ inv }}"
41+
{% endfor %}
42+
test-targets
3543
-e ansible_ssh_user=mitogen__has_sudo
3644
-e ansible_ssh_pass=wrong_password
3745
args:
@@ -52,7 +60,11 @@
5260
ANSIBLE_ANY_ERRORS_FATAL=false
5361
ANSIBLE_STRATEGY=mitogen_linear
5462
ANSIBLE_SSH_ARGS=""
55-
ansible -m shell -a whoami -i "{{MITOGEN_INVENTORY_FILE}}" test-targets
63+
ansible -m shell -a whoami
64+
{% for inv in ansible_inventory_sources %}
65+
-i "{{ inv }}"
66+
{% endfor %}
67+
test-targets
5668
-e ansible_user=mitogen__has_sudo
5769
-e ansible_ssh_pass=has_sudo_password
5870
args:
@@ -65,7 +77,11 @@
6577
ANSIBLE_ANY_ERRORS_FATAL=false
6678
ANSIBLE_STRATEGY=mitogen_linear
6779
ANSIBLE_SSH_ARGS=""
68-
ansible -m shell -a whoami -i "{{MITOGEN_INVENTORY_FILE}}" test-targets
80+
ansible -m shell -a whoami
81+
{% for inv in ansible_inventory_sources %}
82+
-i "{{ inv }}"
83+
{% endfor %}
84+
test-targets
6985
-e ansible_user=mitogen__has_sudo
7086
-e ansible_ssh_pass=wrong_password
7187
args:
@@ -86,7 +102,11 @@
86102
ANSIBLE_ANY_ERRORS_FATAL=false
87103
ANSIBLE_STRATEGY=mitogen_linear
88104
ANSIBLE_SSH_ARGS=""
89-
ansible -m shell -a whoami -i "{{MITOGEN_INVENTORY_FILE}}" test-targets
105+
ansible -m shell -a whoami
106+
{% for inv in ansible_inventory_sources %}
107+
-i "{{ inv }}"
108+
{% endfor %}
109+
test-targets
90110
-e ansible_user=mitogen__has_sudo
91111
-e ansible_password=has_sudo_password
92112
args:
@@ -99,7 +119,11 @@
99119
ANSIBLE_ANY_ERRORS_FATAL=false
100120
ANSIBLE_STRATEGY=mitogen_linear
101121
ANSIBLE_SSH_ARGS=""
102-
ansible -m shell -a whoami -i "{{MITOGEN_INVENTORY_FILE}}" test-targets
122+
ansible -m shell -a whoami
123+
{% for inv in ansible_inventory_sources %}
124+
-i "{{ inv }}"
125+
{% endfor %}
126+
test-targets
103127
-e ansible_user=mitogen__has_sudo
104128
-e ansible_password=wrong_password
105129
args:
@@ -125,7 +149,11 @@
125149
ANSIBLE_ANY_ERRORS_FATAL=false
126150
ANSIBLE_STRATEGY=mitogen_linear
127151
ANSIBLE_SSH_ARGS=""
128-
ansible -m shell -a whoami -i "{{MITOGEN_INVENTORY_FILE}}" test-targets
152+
ansible -m shell -a whoami
153+
{% for inv in ansible_inventory_sources %}
154+
-i "{{ inv }}"
155+
{% endfor %}
156+
test-targets
129157
-e ansible_user=mitogen__has_sudo_pubkey
130158
-e ansible_ssh_private_key_file=../data/docker/mitogen__has_sudo_pubkey.key
131159
args:
@@ -138,7 +166,11 @@
138166
ANSIBLE_ANY_ERRORS_FATAL=false
139167
ANSIBLE_STRATEGY=mitogen_linear
140168
ANSIBLE_SSH_ARGS=""
141-
ansible -m shell -a whoami -i "{{MITOGEN_INVENTORY_FILE}}" test-targets
169+
ansible -m shell -a whoami
170+
{% for inv in ansible_inventory_sources %}
171+
-i "{{ inv }}"
172+
{% endfor %}
173+
test-targets
142174
-e ansible_user=mitogen__has_sudo
143175
-e ansible_ssh_private_key_file=/dev/null
144176
args:

tests/ansible/integration/strategy/mixed_vanilla_mitogen.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
- connection: local
66
command: |
77
ansible-playbook
8-
-i "{{MITOGEN_INVENTORY_FILE}}"
8+
{% for inv in ansible_inventory_sources %}
9+
-i "{{ inv }}"
10+
{% endfor %}
911
-vvv
1012
integration/strategy/_mixed_mitogen_vanilla.yml
1113
args:
@@ -15,7 +17,9 @@
1517
- connection: local
1618
command: |
1719
ansible-playbook
18-
-i "{{MITOGEN_INVENTORY_FILE}}"
20+
{% for inv in ansible_inventory_sources %}
21+
-i "{{ inv }}"
22+
{% endfor %}
1923
-vvv
2024
integration/strategy/_mixed_vanilla_mitogen.yml
2125
args:

tests/ansible/run_ansible_playbook.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,6 @@
4040
'git_basedir': GIT_BASEDIR,
4141
}
4242

43-
if '-i' in sys.argv:
44-
extra['MITOGEN_INVENTORY_FILE'] = (
45-
os.path.abspath(sys.argv[1 + sys.argv.index('-i')])
46-
)
47-
else:
48-
extra['MITOGEN_INVENTORY_FILE'] = (
49-
os.path.join(GIT_BASEDIR, 'tests/ansible/hosts')
50-
)
51-
5243
if 'ANSIBLE_ARGV' in os.environ:
5344
args = eval(os.environ['ANSIBLE_ARGV'])
5445
else:

0 commit comments

Comments
 (0)