issue #543: make localhost_ansible_tests run locally

pull/607/head
David Wilson 5 years ago
parent 57203aef53
commit 501cfca82b

@ -27,11 +27,20 @@ with ci_lib.Fold('job_setup'):
os.chmod('../data/docker/mitogen__has_sudo_pubkey.key', int('0600', 7))
if not ci_lib.exists_in_path('sshpass'):
run("brew install sshpass")
run("brew install http://git.io/sshpass.rb")
with ci_lib.Fold('machine_prep'):
if os.path.expanduser('~mitogen__user1') == '~mitogen_user1':
key_path = os.path.expanduser('~/.ssh/id_rsa')
if not os.path.exists(key_path):
run("ssh-keygen -N '' -f %s", key_path)
auth_path = os.path.expanduser('~/.ssh/authorized_keys')
with open(auth_path, 'a') as fp:
fp.write(open(key_path + '.pub').read())
os.chmod(auth_path, int('0600', 8))
if os.path.expanduser('~mitogen__user1') == '~mitogen__user1':
os.chdir(IMAGE_PREP_DIR)
run("ansible-playbook -i localhost, _user_accounts.yml")
@ -40,4 +49,4 @@ with ci_lib.Fold('ansible'):
os.chdir(TESTS_DIR)
playbook = os.environ.get('PLAYBOOK', 'all.yml')
run('./run_ansible_playbook.py %s -l target %s',
playbook, HOSTS_DIR, ' '.join(sys.argv[1:]))
playbook, ' '.join(sys.argv[1:]))

@ -1,6 +1,7 @@
import multiprocessing
import os
import sys
import tempfile
import mock
@ -221,6 +222,11 @@ class MockLinuxPolicyTest(testlib.TestCase):
for x in range(1, 4096, 32):
policy.assign_subprocess()
MockLinuxPolicyTest = unittest2.skipIf(
condition=(not sys.platform.startswith('linuxPolicy')),
reason='select.select() not supported'
)(MockLinuxPolicyTest)
if __name__ == '__main__':
unittest2.main()

@ -1,5 +1,7 @@
- hosts: all
vars_files:
- shared_vars.yml
strategy: linear
gather_facts: false
tasks:
@ -13,6 +15,8 @@
fi
- hosts: all
vars_files:
- shared_vars.yml
strategy: mitogen_free
# Can't gather facts before here.
gather_facts: true

@ -5,6 +5,8 @@
#
- hosts: all
vars_files:
- shared_vars.yml
gather_facts: true
strategy: mitogen_free
become: true

@ -1,14 +1,3 @@
- hosts: all
gather_facts: false
tasks:
- set_fact:
# Hacktacular.. but easiest place for it with current structure.
sudo_group:
MacOSX: admin
Debian: sudo
Ubuntu: sudo
CentOS: wheel
- include: _container_setup.yml
- include: _user_accounts.yml

@ -0,0 +1,5 @@
sudo_group:
MacOSX: admin
Debian: sudo
Ubuntu: sudo
CentOS: wheel
Loading…
Cancel
Save