Commit a82c6b3b authored by Spiros Koulouzis's avatar Spiros Koulouzis

added 30s timeout to deployer

parent 24692805
...@@ -66,7 +66,7 @@ def install_prerequisites(vm,return_dict): ...@@ -66,7 +66,7 @@ def install_prerequisites(vm,return_dict):
logger.info("Installing ansible prerequisites on: "+vm.ip) logger.info("Installing ansible prerequisites on: "+vm.ip)
ssh = paramiko.SSHClient() ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(vm.ip, username=vm.user, key_filename=vm.key) ssh.connect(vm.ip, username=vm.user, key_filename=vm.key,timeout=30)
sftp = ssh.open_sftp() sftp = ssh.open_sftp()
file_path = os.path.dirname(os.path.abspath(__file__)) file_path = os.path.dirname(os.path.abspath(__file__))
sftp.chdir('/tmp/') sftp.chdir('/tmp/')
......
...@@ -39,7 +39,7 @@ def install_agent(vm, vm_list): ...@@ -39,7 +39,7 @@ def install_agent(vm, vm_list):
logger.info("Starting control agent installation on: "+(vm.ip)) logger.info("Starting control agent installation on: "+(vm.ip))
ssh = paramiko.SSHClient() ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(vm.ip, username=vm.user, key_filename=vm.key) ssh.connect(vm.ip, username=vm.user, key_filename=vm.key,timeout=30)
sftp = ssh.open_sftp() sftp = ssh.open_sftp()
sftp.chdir('/tmp/') sftp.chdir('/tmp/')
vm_cnt = 0 vm_cnt = 0
......
...@@ -51,7 +51,7 @@ def docker_check(vm, compose_name): ...@@ -51,7 +51,7 @@ def docker_check(vm, compose_name):
paramiko.util.log_to_file("deployment.log") paramiko.util.log_to_file("deployment.log")
ssh = paramiko.SSHClient() ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(vm.ip, username=vm.user, key_filename=vm.key) ssh.connect(vm.ip, username=vm.user, key_filename=vm.key,timeout=30)
node_format = '\'{\"ID\":\"{{.ID}}\",\"hostname\":\"{{.Hostname}}\",\"status\":\"{{.Status}}\",\"availability\":\"{{.Availability}}\",\"status\":\"{{.Status}}\"}\'' node_format = '\'{\"ID\":\"{{.ID}}\",\"hostname\":\"{{.Hostname}}\",\"status\":\"{{.Status}}\",\"availability\":\"{{.Availability}}\",\"status\":\"{{.Status}}\"}\''
cmd = 'sudo docker node ls --format ' + (node_format) cmd = 'sudo docker node ls --format ' + (node_format)
......
...@@ -41,7 +41,7 @@ def deploy_compose(vm, compose_file, compose_name,docker_login): ...@@ -41,7 +41,7 @@ def deploy_compose(vm, compose_file, compose_name,docker_login):
paramiko.util.log_to_file("deployment.log") paramiko.util.log_to_file("deployment.log")
ssh = paramiko.SSHClient() ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(vm.ip, username=vm.user, key_filename=vm.key, timeout=10) ssh.connect(vm.ip, username=vm.user, key_filename=vm.key, timeout=30)
sftp = ssh.open_sftp() sftp = ssh.open_sftp()
sftp.chdir('/tmp/') sftp.chdir('/tmp/')
sftp.put(compose_file, "docker-compose.yml") sftp.put(compose_file, "docker-compose.yml")
......
...@@ -41,7 +41,7 @@ def install_engine(vm,return_dict): ...@@ -41,7 +41,7 @@ def install_engine(vm,return_dict):
paramiko.util.log_to_file("deployment.log") paramiko.util.log_to_file("deployment.log")
ssh = paramiko.SSHClient() ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(vm.ip, username=vm.user, key_filename=vm.key ) ssh.connect(vm.ip, username=vm.user, key_filename=vm.key, timeout=30 )
stdin, stdout, stderr = ssh.exec_command("sudo dpkg --get-selections | grep docker") stdin, stdout, stderr = ssh.exec_command("sudo dpkg --get-selections | grep docker")
temp_list = stdout.readlines() temp_list = stdout.readlines()
temp_str = "" temp_str = ""
......
...@@ -95,7 +95,7 @@ def install_worker(join_cmd, vm): ...@@ -95,7 +95,7 @@ def install_worker(join_cmd, vm):
logger.info("Starting kubernetes slave installation on: "+(vm.ip)) logger.info("Starting kubernetes slave installation on: "+(vm.ip))
ssh = paramiko.SSHClient() ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(vm.ip, username=vm.user, key_filename=vm.key) ssh.connect(vm.ip, username=vm.user, key_filename=vm.key,timeout=30)
parentDir = os.path.dirname(os.path.abspath(vm.key)) parentDir = os.path.dirname(os.path.abspath(vm.key))
os.chmod(parentDir, 0o700) os.chmod(parentDir, 0o700)
......
...@@ -41,7 +41,7 @@ def scale_service(vm, application_name, service_name, service_num): ...@@ -41,7 +41,7 @@ def scale_service(vm, application_name, service_name, service_num):
paramiko.util.log_to_file("deployment.log") paramiko.util.log_to_file("deployment.log")
ssh = paramiko.SSHClient() ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(vm.ip, username=vm.user, key_filename=vm.key) ssh.connect(vm.ip, username=vm.user, key_filename=vm.key,timeout=30)
stdin, stdout, stderr = ssh.exec_command("sudo docker service scale %s_%s=%s" % (application_name, service_name, service_num)) stdin, stdout, stderr = ssh.exec_command("sudo docker service scale %s_%s=%s" % (application_name, service_name, service_num))
stdout.read() stdout.read()
logger.info("Finished docker service scaling on: "+vm.ip) logger.info("Finished docker service scaling on: "+vm.ip)
......
...@@ -43,7 +43,7 @@ def install_manager(vm): ...@@ -43,7 +43,7 @@ def install_manager(vm):
paramiko.util.log_to_file("deployment.log") paramiko.util.log_to_file("deployment.log")
ssh = paramiko.SSHClient() ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(vm.ip, username=vm.user, key_filename=vm.key) ssh.connect(vm.ip, username=vm.user, key_filename=vm.key,timeout=30)
stdin, stdout, stderr = ssh.exec_command("sudo docker info | grep 'Swarm'") stdin, stdout, stderr = ssh.exec_command("sudo docker info | grep 'Swarm'")
temp_list1 = stdout.readlines() temp_list1 = stdout.readlines()
stdin, stdout, stderr = ssh.exec_command("sudo docker info | grep 'Is Manager'") stdin, stdout, stderr = ssh.exec_command("sudo docker info | grep 'Is Manager'")
...@@ -79,7 +79,7 @@ def install_worker(join_cmd, vm,return_dict): ...@@ -79,7 +79,7 @@ def install_worker(join_cmd, vm,return_dict):
paramiko.util.log_to_file("deployment.log") paramiko.util.log_to_file("deployment.log")
ssh = paramiko.SSHClient() ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(vm.ip, username=vm.user, key_filename=vm.key) ssh.connect(vm.ip, username=vm.user, key_filename=vm.key,timeout=30)
stdin, stdout, stderr = ssh.exec_command("sudo docker info | grep 'Swarm'") stdin, stdout, stderr = ssh.exec_command("sudo docker info | grep 'Swarm'")
temp_list1 = stdout.readlines() temp_list1 = stdout.readlines()
if temp_list1[0].find("Swarm: active") != -1: if temp_list1[0].find("Swarm: active") != -1:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment