CI: Use templated ansible_user for localhost Ansible tests
refs #1022, #1116
This commit is contained in:
parent
f384fc33d0
commit
e9bddf0c03
|
@ -3,8 +3,6 @@
|
|||
|
||||
from __future__ import print_function
|
||||
|
||||
import getpass
|
||||
import io
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
@ -57,18 +55,6 @@ with ci_lib.Fold('machine_prep'):
|
|||
os.chdir(IMAGE_PREP_DIR)
|
||||
ci_lib.run("ansible-playbook -c local -i localhost, _user_accounts.yml")
|
||||
|
||||
# FIXME Don't hardcode https://github.com/mitogen-hq/mitogen/issues/1022
|
||||
# and os.environ['USER'] is not populated on Azure macOS runners.
|
||||
os.chdir(HOSTS_DIR)
|
||||
with io.open('default.hosts', 'r+', encoding='utf-8') as f:
|
||||
user = getpass.getuser()
|
||||
content = f.read()
|
||||
content = content.replace("{{ lookup('pipe', 'whoami') }}", user)
|
||||
f.seek(0)
|
||||
f.write(content)
|
||||
f.truncate()
|
||||
ci_lib.dump_file('default.hosts')
|
||||
|
||||
cmd = ';'.join([
|
||||
'from __future__ import print_function',
|
||||
'import os, sys',
|
||||
|
|
|
@ -4,8 +4,7 @@
|
|||
# When running the tests outside CI, make a single 'target' host which is the
|
||||
# local machine. The ansible_user override is necessary since some tests want a
|
||||
# fixed ansible.cfg remote_user setting to test against.
|
||||
# FIXME Hardcoded by replacement in some CI runs https://github.com/mitogen-hq/mitogen/issues/1022
|
||||
# and os.environ['USER'] is not populated on Azure macOS runners.
|
||||
# os.environ['USER'] is an empty string on GitHub Actions macOS runners.
|
||||
target ansible_host=localhost ansible_user="{{ lookup('pipe', 'whoami') }}"
|
||||
|
||||
[test-targets]
|
||||
|
|
Loading…
Reference in New Issue