From 1220a46e3a2789161d45553aebe78bc55e4e7b26 Mon Sep 17 00:00:00 2001 From: cocoy Date: Thu, 26 Apr 2012 14:46:32 +0800 Subject: [PATCH] Bugfix for issue #245. Do not override the value of user and hostname. Get port and identityfile only. --- lib/ansible/connection.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/ansible/connection.py b/lib/ansible/connection.py index 649aacdd250..ca85cdc1b9e 100644 --- a/lib/ansible/connection.py +++ b/lib/ansible/connection.py @@ -81,7 +81,8 @@ class ParamikoConnection(object): keypair = None # Read file ~/.ssh/config, get data hostname, keyfile, port, etc - # This overrides the ansible defined username,hostname and port + # This will *NOT* overrides the ansible username and hostname " , getting the port and keyfile only. + try: ssh_config = paramiko.SSHConfig() config_file = ('~/.ssh/config') @@ -92,12 +93,12 @@ class ParamikoConnection(object): except IOError,e: raise errors.AnsibleConnectionFailed(str(e)) - if 'hostname' in credentials: - self.host = credentials['hostname'] + #if 'hostname' in credentials: + # self.host = credentials['hostname'] if 'port' in credentials: self.port = int(credentials['port']) - if 'user' in credentials: - user = credentials['user'] + #if 'user' in credentials: + # user = credentials['user'] if 'identityfile' in credentials: keypair = os.path.expanduser(credentials['identityfile'])