Merge pull request #1150 from moreati/local-options

Add and test templated local connection parameters
pull/1148/head
Alex Willmer 1 month ago committed by GitHub
commit 3b2b03bd97
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -3,8 +3,6 @@
from __future__ import print_function from __future__ import print_function
import getpass
import io
import os import os
import subprocess import subprocess
import sys import sys
@ -57,18 +55,6 @@ with ci_lib.Fold('machine_prep'):
os.chdir(IMAGE_PREP_DIR) os.chdir(IMAGE_PREP_DIR)
ci_lib.run("ansible-playbook -c local -i localhost, _user_accounts.yml") 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([ cmd = ';'.join([
'from __future__ import print_function', 'from __future__ import print_function',
'import os, sys', 'import os, sys',

@ -4,8 +4,7 @@
# When running the tests outside CI, make a single 'target' host which is the # 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 # local machine. The ansible_user override is necessary since some tests want a
# fixed ansible.cfg remote_user setting to test against. # 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 # os.environ['USER'] is an empty string on GitHub Actions macOS runners.
# and os.environ['USER'] is not populated on Azure macOS runners.
target ansible_host=localhost ansible_user="{{ lookup('pipe', 'whoami') }}" target ansible_host=localhost ansible_user="{{ lookup('pipe', 'whoami') }}"
[test-targets] [test-targets]

Loading…
Cancel
Save