_runner = staticmethod(run.run)
def __init__(self, name, ssh=None, shortname=None, console=None,
- host_key=None, keep_alive=True, ssh_port=22):
+ host_key=None, keep_alive=True, port=22):
self.name = name
if '@' in name:
(self.user, hostname) = name.split('@')
self.keep_alive = keep_alive
self.console = console
self.ssh = ssh
- self.ssh_port = ssh_port
+ self.ssh_port = port
def connect(self, timeout=None):
args = dict(user_at_host=self.name, host_key=self._host_key,
"""
remotes = []
machs = []
- ssh_port = ctx.config.get('ssh_port', 22)
for name in ctx.config['targets'].iterkeys():
machs.append(name)
for t, key in ctx.config['targets'].iteritems():
+ port = 22
+ if ':' in t:
+ port = int(t.split(':')[1])
+ t = t.split(':')[0]
t = misc.canonicalize_hostname(t)
try:
if ctx.config['sshkeys'] == 'ignore':
key = None
except (AttributeError, KeyError):
pass
- rem = remote.Remote(name=t, host_key=key,
- keep_alive=True, ssh_port=ssh_port)
+ rem = remote.Remote(name=t, host_key=key, keep_alive=True, port=port)
remotes.append(rem)
ctx.cluster = cluster.Cluster()
if 'roles' in ctx.config: