|
|
@ -1,9 +1,7 @@
|
|
|
|
#!/usr/bin/env python
|
|
|
|
#!/usr/bin/env python
|
|
|
|
# Run tests/ansible/all.yml under Ansible and Ansible-Mitogen
|
|
|
|
# Run tests/ansible/all.yml under Ansible and Ansible-Mitogen
|
|
|
|
|
|
|
|
|
|
|
|
import glob
|
|
|
|
|
|
|
|
import os
|
|
|
|
import os
|
|
|
|
import shutil
|
|
|
|
|
|
|
|
import sys
|
|
|
|
import sys
|
|
|
|
|
|
|
|
|
|
|
|
import ci_lib
|
|
|
|
import ci_lib
|
|
|
@ -31,16 +29,17 @@ with ci_lib.Fold('job_setup'):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
with ci_lib.Fold('machine_prep'):
|
|
|
|
with ci_lib.Fold('machine_prep'):
|
|
|
|
ssh_dir = os.path.expanduser('~/.ssh')
|
|
|
|
# generate a new ssh key for localhost ssh
|
|
|
|
if not os.path.exists(ssh_dir):
|
|
|
|
os.system("ssh-keygen -P '' -m pem -f ~/.ssh/id_rsa")
|
|
|
|
os.makedirs(ssh_dir, int('0700', 8))
|
|
|
|
os.system("cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys")
|
|
|
|
|
|
|
|
# also generate it for the sudo user
|
|
|
|
key_path = os.path.expanduser('~/.ssh/id_rsa')
|
|
|
|
os.system("sudo ssh-keygen -P '' -m pem -f /var/root/.ssh/id_rsa")
|
|
|
|
shutil.copy(KEY_PATH, key_path)
|
|
|
|
os.system("sudo cat /var/root/.ssh/id_rsa.pub | sudo tee -a /var/root/.ssh/authorized_keys")
|
|
|
|
|
|
|
|
os.chmod(os.path.expanduser('~/.ssh'), int('0700', 8))
|
|
|
|
auth_path = os.path.expanduser('~/.ssh/authorized_keys')
|
|
|
|
os.chmod(os.path.expanduser('~/.ssh/authorized_keys'), int('0600', 8))
|
|
|
|
os.system('ssh-keygen -y -f %s >> %s' % (key_path, auth_path))
|
|
|
|
# run chmod through sudo since it's owned by root
|
|
|
|
os.chmod(auth_path, int('0600', 8))
|
|
|
|
os.system('sudo chmod 600 /var/root/.ssh')
|
|
|
|
|
|
|
|
os.system('sudo chmod 600 /var/root/.ssh/authorized_keys')
|
|
|
|
|
|
|
|
|
|
|
|
if os.path.expanduser('~mitogen__user1') == '~mitogen__user1':
|
|
|
|
if os.path.expanduser('~mitogen__user1') == '~mitogen__user1':
|
|
|
|
os.chdir(IMAGE_PREP_DIR)
|
|
|
|
os.chdir(IMAGE_PREP_DIR)
|
|
|
|