Commit 9a6308e4 authored by Oceans's avatar Oceans

update leave

parent 3f57da61
......@@ -25,6 +25,8 @@ def install_manager(vm):
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(vm.ip, username=vm.user, key_filename=vm.key)
stdin, stdout, stderr = ssh.exec_command("sudo docker swarm leave --force")
stdout.read()
stdin, stdout, stderr = ssh.exec_command("sudo docker swarm init --advertise-addr eth0")
retstr = stdout.readlines()
print "%s: ========= Swarm Manager Installed =========" % (vm.ip)
......@@ -40,6 +42,8 @@ def install_worker(join_cmd, vm):
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(vm.ip, username=vm.user, key_filename=vm.key)
stdin, stdout, stderr = ssh.exec_command("sudo docker swarm leave --force")
stdout.read()
stdin, stdout, stderr = ssh.exec_command("sudo %s" % (join_cmd))
stdout.read()
print "%s: ========= Swarm Worker Installed =========" % (vm.ip)
......
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