Skip to content

Commit

Permalink
Merge pull request #1150 from moreati/local-options
Browse files Browse the repository at this point in the history
Add and test templated local connection parameters
  • Loading branch information
moreati authored Oct 11, 2024
2 parents f384fc3 + e9bddf0 commit 3b2b03b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 16 deletions.
14 changes: 0 additions & 14 deletions .ci/localhost_ansible_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

from __future__ import print_function

import getpass
import io
import os
import subprocess
import sys
Expand Down Expand Up @@ -57,18 +55,6 @@
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',
Expand Down
3 changes: 1 addition & 2 deletions tests/ansible/hosts/default.hosts
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 3b2b03b

Please sign in to comment.