diff options
Diffstat (limited to 'func/env_setup.py')
-rw-r--r-- | func/env_setup.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/func/env_setup.py b/func/env_setup.py index ca83f040..9e21a5b6 100644 --- a/func/env_setup.py +++ b/func/env_setup.py @@ -46,7 +46,7 @@ class Env_setup: @staticmethod def write_to_file(role): - f_name_2 = open('./data/hosts', 'w') + f_name_2 = open('./config/hosts', 'w') print role.items() for k in role: f_name_2.write('[' + k + ']\n') @@ -58,29 +58,29 @@ class Env_setup: @staticmethod def ssh_test(hosts): for ip, pw in hosts: - print '\nBeginning SSH Test: %s \n' % ip - os.system('ssh-keyscan %s >> ~/.ssh/known_hosts' % ip) + logger.info('Beginning SSH Test: %s \n' % ip) + os.system('ssh-keyscan %s >> /root/.ssh/known_hosts' % ip) time.sleep(2) - ssh_cmd = './data/qtip_creds.sh %s' % ip - print "run command: %s " % ssh_cmd + ssh_cmd = './scripts/qtip_creds.sh %s' % ip + logger.info("run command: %s " % ssh_cmd) os.system(ssh_cmd) ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) - ssh.connect(ip, key_filename='./data/QtipKey') + ssh.connect(ip, key_filename='./config/QtipKey') for attempts in range(100): try: stdin, stdout, stderr = ssh.exec_command('uname') if not stderr.readlines(): - print('SSH successful') + logger.info('SSH successful') break except socket.error: - print 'SSH is still unavailable, retry!' + logger.error('SSH is still unavailable, retry!') time.sleep(2) if attempts == 99: - print "Try 99 times, SSH failed: %s" % ip + logger.error("Try 99 times, SSH failed: %s" % ip) @staticmethod def ping_test(lister, attempts=30): @@ -109,7 +109,7 @@ class Env_setup: if not installer_ip: raise RuntimeError("undefine environment variable INSTALLER_IP") - cmd = "bash ./data/fetch_compute_ips.sh -i %s -a %s" % \ + cmd = "bash ./scripts/fetch_compute_ips.sh -i %s -a %s" % \ (installer_type, installer_ip) logger.info(cmd) os.system(cmd) |