fabric/fabric — Issue #577: Connect error on hosts with different ports
Author: jsegura
Created: 2012-03-08 14:01:46+00:00
State: open

I have the followin scenario:

* ~/.ssh/config:
Host server1
Hostname server1.domain.tld
User root
Port 60043

Host server2
User root
Hostname server.domain.tld
Port 60045

* fabfile.py
from fabric.api import *

env.hosts = ["server1", "server2"]
env.use_ssh_config = True

def hello():
run('ls /tmp')

When I execute the task hello, the connection of the second server uses the port from the first one. It seems that it con't get updated. I use strace to see the problem:

connect(3, {sa_family=AF_INET, sin_port=htons(60042), sin_addr=inet_addr("IP OF SERVER1")}, 16) = -1 EINPROGRESS (Operation now in progress)
connect(5, {sa_family=AF_INET, sin_port=htons(60042), sin_addr=inet_addr("IP OF SERVER2")}, 16) = -1 EINPROGRESS