tests: Don't rely on facts when setting become

They won't be available if the play is first, and hence no facts have been
gather in previous play(s), e.g. due to --start-at-task
pull/964/head
Alex Willmer 2 years ago
parent 1ed932e8d5
commit edd2868ef6

@ -66,14 +66,16 @@ with ci_lib.Fold('job_setup'):
for container in containers for container in containers
) )
for distro, hostnames in distros.items(): for distro, hostnames in sorted(distros.items(), key=lambda t: t[0]):
fp.write('\n[%s]\n' % distro) fp.write('\n[%s]\n' % distro)
fp.writelines('%s\n' % name for name in hostnames) fp.writelines('%s\n' % name for name in hostnames)
for family, hostnames in families.items(): for family, hostnames in sorted(families.items(), key=lambda t: t[0]):
fp.write('\n[%s]\n' % family) fp.write('\n[%s]\n' % family)
fp.writelines('%s\n' % name for name in hostnames) fp.writelines('%s\n' % name for name in hostnames)
fp.write('\n[linux:children]\ntest-targets\n')
ci_lib.dump_file(inventory_path) ci_lib.dump_file(inventory_path)
if not ci_lib.exists_in_path('sshpass'): if not ci_lib.exists_in_path('sshpass'):

@ -2,7 +2,7 @@
--- ---
- name: regression/issue_776__load_plugins_called_twice.yml - name: regression/issue_776__load_plugins_called_twice.yml
hosts: test-targets hosts: test-targets
become: "{{ ansible_facts.pkg_mgr not in ['homebrew'] }}" become: "{{ groups.linux is defined and inventory_hostname in groups.linux }}"
gather_facts: yes gather_facts: yes
tags: tags:
- issue_776 - issue_776

Loading…
Cancel
Save