mirror of
https://github.com/jpetazzo/container.training.git
synced 2026-07-29 01:31:11 +00:00
Merge branch 'master' into swarm2017
This commit is contained in:
@@ -202,14 +202,23 @@ def check_exit_status():
|
|||||||
|
|
||||||
def setup_tmux_and_ssh():
|
def setup_tmux_and_ssh():
|
||||||
if subprocess.call(["tmux", "has-session"]):
|
if subprocess.call(["tmux", "has-session"]):
|
||||||
logging.info("Couldn't connect to tmux. A new tmux session will be created.")
|
logging.error("Couldn't connect to tmux. Please setup tmux first.")
|
||||||
subprocess.check_call(["tmux", "new-session", "-d"])
|
ipaddr = open("../../prepare-vms/ips.txt").read().split("\n")[0]
|
||||||
wait_for_string("$")
|
uid = os.getuid()
|
||||||
send_keys("cd ../prepare-vms\n")
|
|
||||||
send_keys("ssh docker@$(head -n1 ips.txt)\n")
|
raise Exception("""
|
||||||
wait_for_string("password:")
|
1. If you're running this directly from a node:
|
||||||
send_keys("training\n")
|
|
||||||
wait_for_prompt()
|
tmux
|
||||||
|
|
||||||
|
2. If you want to control a remote tmux:
|
||||||
|
|
||||||
|
rm -f /tmp/tmux-{uid}/default
|
||||||
|
ssh -t -L /tmp/tmux-{uid}/default:/tmp/tmux-1001/default docker@{ipaddr} tmux
|
||||||
|
|
||||||
|
3. If you cannot control a remote tmux:
|
||||||
|
tmux new-session ssh docker@{ipaddr}
|
||||||
|
""".format(uid=uid, ipaddr=ipaddr))
|
||||||
else:
|
else:
|
||||||
logging.info("Found tmux session. Trying to acquire shell prompt.")
|
logging.info("Found tmux session. Trying to acquire shell prompt.")
|
||||||
wait_for_prompt()
|
wait_for_prompt()
|
||||||
|
|||||||
Reference in New Issue
Block a user