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
This commit is contained in:
Alex Willmer 2022-09-12 19:20:58 +01:00
parent 1ed932e8d5
commit edd2868ef6
2 changed files with 5 additions and 3 deletions

View File

@ -66,14 +66,16 @@ with ci_lib.Fold('job_setup'):
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.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.writelines('%s\n' % name for name in hostnames)
fp.write('\n[linux:children]\ntest-targets\n')
ci_lib.dump_file(inventory_path)
if not ci_lib.exists_in_path('sshpass'):

View File

@ -2,7 +2,7 @@
---
- name: regression/issue_776__load_plugins_called_twice.yml
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
tags:
- issue_776