From 4c64d0d6beed29af94a821efc59f14a7d58901df Mon Sep 17 00:00:00 2001 From: Tim Gerla Date: Sun, 20 Jan 2013 13:16:01 -0800 Subject: [PATCH] Expand ~ shell shortcuts for the --private-key argument --- lib/ansible/runner/connection_plugins/paramiko_ssh.py | 2 +- lib/ansible/runner/connection_plugins/ssh.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ansible/runner/connection_plugins/paramiko_ssh.py b/lib/ansible/runner/connection_plugins/paramiko_ssh.py index c532e8fd5a2..898c24bf065 100644 --- a/lib/ansible/runner/connection_plugins/paramiko_ssh.py +++ b/lib/ansible/runner/connection_plugins/paramiko_ssh.py @@ -82,7 +82,7 @@ class Connection(object): allow_agent = False try: ssh.connect(self.host, username=user, allow_agent=allow_agent, look_for_keys=True, - key_filename=self.runner.private_key_file, password=self.runner.remote_pass, + key_filename=os.path.expanduser(self.runner.private_key_file), password=self.runner.remote_pass, timeout=self.runner.timeout, port=self.port) except Exception, e: msg = str(e) diff --git a/lib/ansible/runner/connection_plugins/ssh.py b/lib/ansible/runner/connection_plugins/ssh.py index 66a7bcf5048..ea9b03bad94 100644 --- a/lib/ansible/runner/connection_plugins/ssh.py +++ b/lib/ansible/runner/connection_plugins/ssh.py @@ -53,7 +53,7 @@ class Connection(object): if self.port is not None: self.common_args += ["-o", "Port=%d" % (self.port)] if self.runner.private_key_file is not None: - self.common_args += ["-o", "IdentityFile="+self.runner.private_key_file] + self.common_args += ["-o", "IdentityFile="+os.path.expanduser(self.runner.private_key_file)] if self.runner.remote_pass: self.common_args += ["-o", "GSSAPIAuthentication=no", "-o", "PubkeyAuthentication=no"]